Firestore Pricing - Does The Amount Of Documents In A Collection Matters?

Viewed 7107

I have read in the documentation that I'm being charged for the amount of the requests I'm making to read, write or update documents. I have also read that reading a collection is priced the same as a reading a document ("For queries other than document reads, such as a request for a list of collection IDs, you are billed for one document read."), correct me if I'm wrong.

My question is: Does reading a collection with a big amount of documents in it (let's say - 10,000 documents) is priced the same as reading one with 10?

I'd like to get some explaination about it...

1 Answers

It depends on what you mean by "reading a collection", but for most people this means "querying a bunch of documents from a collection". And the answer is that the pricing generally depends on the number of documents retrieved.

To oversimplify things just a bit:

If you have a collection of 10 employees and you run a collection("employees").get() call, you will get back 10 employee documents, and be charged for 10 reads.

If you have a collection of 10,000 employees and you run a collection("employees").get() call, you will get back 10,000 employees, and be charged for 10,000 reads.

If you have a collection of 10,000 employees and you run a collection("employees").get().limit(10) call, you will get back 10 employees, and be charged for 10 reads.

If you have a collection of 10,000 employees, 4 of which are named "Courtney" and you run a collection("employees").where("first_name", "==", "Courtney") call, you will get back 4 employees and be charged for 4 reads.

Related