Reputation: 53
I have a Distributed counters with 10 shards, now if I want know the Total of the counter I'll do a valueChanges or a snaphotChanges ad I have 10 reads, but if in real-time someone else update 1 shard... for the new Total in real-time I have one read more or I have to repeat the 10 reads?
Upvotes: 0
Views: 303
Reputation: 317402
If your code is listening to a query that matches 10 documents, the listener will first cost 10 reads to read all those documents, then 1 additional read each time any of those documents changes.
It will not cost 10 reads every time your listener is invoked in response to a change of 1 document. The cost of a read is only incurred when a document actually changes. The other unchanged documents are reused from memory used by the client SDK.
Upvotes: 2