Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cloud Firestore: How is read calculated?

Tags:

In Cloud Firestore we are charged for read/write/delete operations. Perhaps this is obvious for some but I could not find anywhere what is considered read. If I have a collection of 10 records and I fetch them all in form of a list, does it count as 10 reads or 1 (since I read only once from the database)?

like image 433
Bielik Avatar asked Jun 16 '18 11:06

Bielik


People also ask

What is one read in firestore?

In Firebase firestore, read is counted in 2 ways, Here 1 document = 1 read.


2 Answers

Since you're reading 10 documents, so you'll be charged for 10 document reads. The number of read API calls you use is not relevant here.

Also see:

  • Firestore read/write pricing; does .limit(25) counts as 25 reads or one?
  • Understanding Firestore Pricing
  • Firestore Pricing - Does The Amount Of Documents In A Collection Matters?
  • QuizApp - Firebase/ FireStore Reads
like image 161
Frank van Puffelen Avatar answered Sep 27 '22 23:09

Frank van Puffelen


I did a bunch of testing of this and can confirm that the Firebase Database tab uses an insane amount of reads. For me it incurred a 600+ read count every single time I opened it. If I clicked off that tab and back onto it, I would get another 600+ hit on read count. I monitored the usage of this using the GCP Usage for Firestore so I could avoid having that window open.

This is an absurd cost, it has taken me into 100k+ reads by scrolling through it without realizing what was happening. You could even hit a million pretty easy if you were spending a lot of time in there doing something.

In addition, if you leave that tab open as you make calls, it throws your numbers WAY WAY off as it also shows real time updates.

Be very careful when and how you use these tools. Personally I don't think it makes sense to incur usage costs for using internal tools. Especially since they don't even tell you these tools will incur usage costs.

like image 21
emalamisura Avatar answered Sep 27 '22 23:09

emalamisura