Lets say I am persisting movies in a collection with a createdAt
property. My android app wants to show all recently added movies in a list by querying this collection with an orderBy
statement on the createdAt
. I also add a limit 20
at the initial request, and increase this when user scrolls dynamically.
Are these pricing model assumptions correct for these situations:
- App is getting started the first time (assumption: 20 read ops because no cached data was available)
- App gets closed and opened again. No changes are made in the meanwhile (assumption: 0 read ops since data can get fetched from the cache)
- User scrolls. Old snapshot listener gets replaced with a new one where the limit is increased to 40. No changes are made in the meanwhile (assumption: 20 read ops, since there already were 20 known in cache before)
- Change is made to db. (assumption: 1 read op)
These assumptions are made based on this stackoverflow post.
But this explanation video (at 8:05) made by the firebase team themselves explains that the case 3 would cost me 40 read ops though. Is this true or is it explained a bit misleading ?
And if the assumptions were correct, how does the library know that there is no need to make new read ops at case 2.?