Home > Mobile >  Firebase: performance VS plan quota/limitations
Firebase: performance VS plan quota/limitations

Time:08-13

I have this collections tree:

users/portfolios/rents/events

So in order to find specific events for all users I can:

  1. Collection Group Query
  2. Move events to a separate collection with userID, portfoliosID and rentsID. And in rents documents, have a list of different eventsIDs

What option is better based on Firebase's monthly limitation plan and performance?

CodePudding user response:

You can use a collection group query along with a "WHERE" clause. So I cannot see a reason why you would change this structure. Don't forget to create also an index.

What option is better based on Firebase's monthly limitation plan and performance?

Regarding costs, it doesn't really matter if you use a collection group query or a regular query, you'll always have to pay a number of reads that is equal to the number of documents that are returned.

Regarding performance, none. In Firestore the query performance depends on the number of documents you request and not on the number of documents you search. It doesn't really matter if you get 10 documents out of 100 or out of 100 million, the response time will always be the same.

Besides that, in the NoSQL world, we are usually structuring a database according to the queries that we want to perform. So keep in mind that.

  • Related