2

I have a collection group query for Posts subcollections (can be nested up to into 2 subcollections) ex.

firestore {
  users: <Collection> {
    posts: <subcollection> {... posts}
    types : <subcollection> {
     type1: <subcollection> : {
       posts: <subcollection> {... posts}
     } 
   }
}

For that i currently have a compound index and it is working well .

My question is, will be more performant to have 1 top level Collection Posts (denormalized with a cloud function) and query it instead?.

Doug Stevenson
  • 297,357
  • 32
  • 422
  • 441

1 Answers1

3

Collection group queries use fundamentally the same indexing strategy as normal queries, so they should operate with the same performance. Specifically, this means that the queries will scale with the size of the result set, not with the size of the collection(s).

Doug Stevenson
  • 297,357
  • 32
  • 422
  • 441