2
votes

Following up on my previous post learning about write limits to individual collections

Firestore 500+ Writes Per Second to One Collection

How does this 500ps limit apply to CollectionGroups that were recently introduced? (btw...Todd didn't get a loud enough cheer here! :P)

https://firebase.google.com/docs/firestore/query-data/queries#collection-group-query

Firestore limits still only reference individual collections:

https://firebase.google.com/docs/firestore/quotas

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

Dan McGrath in my previous post said this is because indexing for Individual Collections

will be limited by the load a single server can handle.

Example data model:

  • Collection: users
  • Doc: userId1
  • Subcollection: posts
  • Doc: postId1 (fields for postId, img, caption, date)

If I create a CollectionGroup Index for posts (query across all subcollections called "posts") - order DESCENDING by date

Would my write limit across all those subcollections go down from 10k per second to 500 per second? How is CollectionGroup indexing handled? By the same "individual server"?

If so...this essentially means theres no benefit to putting these "posts" in separate subcollections vs. one individual root level collection from a write limit perspective.

1
Any insights here Firebase team???? - siefix

1 Answers

0
votes

Asked on Firebase Google Group - answer is yes, you are limited to 500 writes per second across subcollections if you start indexing them using CollectionGroupQuery

https://groups.google.com/forum/#!topic/firebase-talk/7Raajf8KWg4

As with many limitations of Cloud Firestore, this limit is based on our ability to index data and maintain strong consistency. So yes: if you have a CollectionGroup index on "date" and your date field has sequential values, you should not exceed 500QPS write rate for updates for "posts" documents.