Jolzal
Jolzal

Reputation: 597

How firestore count read on flutter

I have several question about how does firebase count read in my flutter app,

  1. i have an app which use multiple firestore snapshot as stream like this:

    _firestore
     .collection(salesOrderPath)
     .where("unit", isEqualTo:  1)
     .snapshots()
    
     _firestore
     .collection(salesOrderPath)
     .where("status", isEqualTo:  2)
     .snapshots()
    

This two stream contain some same document, does that same document counted twice or once?

2.If i have multiple where filter on my firestore snapshot like this:

_firestore
    .collection(salesOrderPath)
    .where("unit", isEqualTo:  1)//10 Document
    .where("status", isEqualTo:  2)//4 Document
    .orderBy('creationDate',descending: true)        
    .snapshots()

Would i be charged by 10 read or just 4?

  1. Maybe not related, but i saw something called Network egress as limit in the firebase pricing, what is this network egress meaning actually is it for storage or for firestore?

  2. How long does cache from firestore in our app last before we need to reread it again from firestore?

I am new at this and dont quite understand a lot of thing, thankyou so much for answering

Upvotes: 0

Views: 1280

Answers (2)

SRR
SRR

Reputation: 1758

Firestore bills you for your result set. So if your whole query returns 10 documents from a million documents. You only get billed for those 10 documents.

Network Egress is:

Network traffic that begins inside of a network and proceeds through its routers to a destination somewhere outside of the network

So if you ask for one document, you get billed for that 1 read plus the 'work done' for firestore to get that document for you.

The cache does not have an explicit expiry date. It will expire if it needs to make more space for new data or there was a deletion server-side and your cache now needs to resync. The size of the cache is 40MB.

Like others have mentioned I highly recommend their series on youtube

Upvotes: 1

vitooh
vitooh

Reputation: 4272

I think you should definitely watch video on Firebase Guide regarding pricing (actually I suggest to watch all of them).

I don't think you will find better description of pricing.

I guess question#1 is 2 reads as there are 2 queries. Question#2 anwser is 4 reads. Question#3 - if you watch the video you will know that this is rather negligible cost.

Now point 4#. Unfortunately I don't know, but I found something that might be interesting for you here.

Upvotes: 1

Related Questions