Are Firebase Queries Scalable

Are Firebase queries scalable

Hundreds: yes

Thousands: yes

Tens of thousands... probably (and congratulations on the success of your app)

Hundreds of thousands... you're likely better off with a non query-based data model. For example: if you want to access some data for the user by their email address, store a map from email address to uid:

emailToUid
"HelixProbe@stackoverflow,com": "uid6479958"
"puf@stackoverflow.com": "uid209103"

With such a simple list, you can read the user's data from their email address with two direct lookups, instead of one query (which will get slower as more and more items are added).

Firebase Firestore - Performance of multiple simultaneous read queries on a single collection with billions of documents

  1. Yes, Firestore scales massively.

  2. The time to fetch 1 document in 1 million is the same as the time to fetch 1 document in 1 trillion. The size of the collection doesn't matter in terms of read performance. What matters is the number of documents you're querying.

Queries scale with the size of your result set, not the size of your data set

This may be written a bit confusing. It is not a use-case in the classic sense its just a statement about the performance of Firestore.

It basically says that it does not matter if you request 1 item out of a 100 or 1 item out of 100.000.000, it will be equally fast. Here 1 is your result set and 100/100.000.000 is your data set. So requesting 1 item out of 100.000.000 will be faster than requesting 50 items out of 100.

I hope this makes it a bit clearer!



Related Topics



Leave a reply



Submit