I have a question about the firebase database pricing. I have about 400,000 rows in the leaderboard of my database, but in my app I just want to load the last 500 rows, so my question will I get charged for the 500 rows loaded when I run the query or will I get charged for all 400,000 rows.
Realtime database charges 5$ per gb stored and 1$ per gb downloaded. I did the calculation with Firestore and found that Realtime Database would be way cheaper if i get charged for the 500 rows and not the 400,000 rows.
I searched all documentation and have not found anything about queries: https://firebase.google.com/pricing https://firebase.google.com/docs/database/usage/billing
Can someone tell me if I get charged for just the 500 rows in my collection or for all the data in the collection and if there is a way to only get charged for the 500 rows maybe with security rules?
Here is my query code:
let queryRef = ref.child("Leaderboard").queryOrdered(byChild: "totalStars").queryLimited(toLast: 500)
How the database looks like. (It will have about 500,000 childs same as these and be loaded 200,000 per day, But I just want to be priced on the top 500 that I load and not the whole 500,000 each time a user loads the leaderboard is it possible?)
