I have a couple of apps that my users use and I want to track their usage for API limiting and weekly emails. I'm using the Firebase Realtime NoSQL DB.
I'm struggling to find best practices for NoSQL Database setup for usage tracking when one user could use the app 100s of times one day, and others not at all. I know I need to save timestamps, but I'm not sure the actual setup that's recommended.
Option 1:
<user_id>/<app_name>/<day_integer>
and save a timestamp
array. To get usage over an entire month tho I think I'd have to make 30 requests.
Option 2:
<user_id>/usage/<day_integer>
and save or update key app_name
with the usage count (1, 2, 100, etc). To get usage over an entire month I think I need to make 30 requests.
Option 3:
<user_id>/usage
and save objects with app_name
and timestamp
values. I would have a ton of objects which means I'd have to do a lot of data transfer and filtering.
I only need timestamps to build usage charts. I can't find any article on best practices for database architecture for usage tracking. Does anyone have any insights on what is the best practice?