Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

collection performance in Firestore

i am some confuse between two choices in Firestore collection

in my Firestore i have ability to make only one main collection then make others collections as sub collections into same that main collection

now my question is this will make my main collection in big pressure ? .
should i make others main collections instead of sub collections? or this will be the same ?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

in other word : Will the performance of the collection which has no sub collections be better than the collection which has many sub collections? i mean per doc has sub collections .

what is the best choice ?

>Solution :

The main performance guarantee that Firestore makes is that the performance on a query depends on the amount of data it reads, not on the amount of data it has to consider.

So there is no performance difference between getting the same set of data from a smaller subcollection or getting it from one big top-level collection.


There is however a difference in write performance between the two approaches, so that is usually to pick one or the other.

Performance pressure comes from updating the indexes for each write operation, where having multiple subcollections will allow better throughput as the writes to separate subcollections are isolated from each other.

The one exception to that is when you have a collection group index, as the writes to all collections in that group will have to update the same index.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading