How to drastically reduce the number of reads when no documents are changed in Firestore?

Alex Mamo
Firebase Tips & Tricks
5 min readMay 27, 2020

--

As a constant contributor on Stackoverflow, I’ve seen many questions regarding the way Firestore charges the read operations, so I’ve decided to write this article to provide a little more information. I’ll also explain a workaround that is useful if you want to drastically reduce the number of reads when no documents are changed on the Firebase servers.

Understand the Firestore billing mechanism

When we are using Cloud Firestore, we are charged for the number of reads, writes, and deletes that we perform. In this article, I’ll only talk about the reads. So we are charged with a read operation each time a document in the result set is added or updated. There is also a charge of one document read, even if the query yields no documents. But let’s take a concrete example for a better understanding.

Suppose we have an Android/iOS application for an online store. Each category of products is represented by a collection of documents. Let’s assume we have a collection that contains 50 products. When we perform a query against this collection using a get() call, the price that we’ll have to pay is equal to the number of documents that are returned. Now, there are two situations:

  • When the user has…

--

--