Search code examples
firebaselimitsgoogle-cloud-firestore

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?


Solution

  • 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.