Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

A limit clarification for the new Firestore

So in the limits section (https://firebase.google.com/docs/firestore/quotas) of the new Firestore product from Firebase it says:

Maximum write rate to a collection in which documents contain sequential values in an indexed field: 500 per second

We're pretty confused as to what that actually entails.

If we have, say, a root-level collection called users with 10 million entries in it, will this rate affect this collection in such a way, so only 500 users can update their data in any given second?

Can anyone clarify?

like image 280
DarkNeuron Avatar asked Oct 04 '17 14:10

DarkNeuron


People also ask

What is the limited depth of Subcollections in firestore?

I saw on the Firebase Firestore documentation that the limits for the "Maximum depth of subcollections" is 100.

What is the limit of Firebase storage?

Quota for Hosting storage Storage for your Hosting content is at no cost up to 10 GB. If you are not on the Blaze plan, and you reach the 10 GB limit of no-cost Hosting storage, you won't be able to deploy new content to your sites.

What is the maximum size for a document name in cloud firestore?

6. Document size limit of 1MB. Firestore places a limit of 1MB on the amount of data that can be stored in a single document.


2 Answers

Sorry for the confusion; an example might help.

If your user documents contained a last-updated timestamp and you index on that timestamp then each new write would end up clustering around the same value (now) creating a hotspot in the index.

Similarly if you somehow assigned users a sequential value like a place in line or something like that this would also create a hotspot.

Incidentally this is why generated document IDs are random strings. This evenly distributes the writes on the primary key index.

If you avoid these kinds of patterns the sky's the limit, though during beta you'd hit the database-wide limit.

like image 112
Gil Gilbert Avatar answered Sep 19 '22 16:09

Gil Gilbert


A quick additional note : for the moment all properties are indexed by default, so if you had a last-updated timestamp it would necessarily be indexed - so you would not be able to avoid the hotspoting.

Index disablement will be available down the road though.

like image 27
Alex Dufetel Avatar answered Sep 20 '22 16:09

Alex Dufetel