1

I don't understand the way "firestore" counts the reads for the quota and billing.

Example: I have a collection with 200'000 documents. Every document has a timestamp as attribute. Now I would like to get all documents within the last hour. So I create a query which gives me back all documents with "timestamp > now()-60 minutes". The result is a set of 10 documents. Does Firestore counts 10 document reads or 200'000 documents read for this? I would like to build a query that read a document always once (fetch, not real time).

I assume that firestore is only at the first view a cheaper solution than with other solution (e.g. google cloud sql, aws etc).

hans
  • 23
  • 3

1 Answers1

4

To allow that query, you will need to have an index on timestamp. Firestore uses that index to determine what documents to return. So this would count as 10 document reads.

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807