0

I'm wondering if the amount of documents in a collection in Firestore database will affect the query-time using the where() method in Flutter?

For example I've a User-Collection with millions of users. When I query only certain users like below:

db.collection("users").where("age", isEqualTo: 20).get().then(
  (res) => print("Successfully completed"),
  onError: (e) => print("Error completing: $e"),
);

Let's say the Future returns only 100 User Documents within 1.000 or 100.000.000 User Documents.

Does it matter how many documents are inside the collection in terms of query-time?

Thanks

Doug Stevenson
  • 297,357
  • 32
  • 422
  • 441
Ayrix
  • 433
  • 5
  • 16
  • 1
    Query performance scales with the size of the query result set, not the size of the collection. Large collections are no different than small collection for the purpose of determining the speed at which the query finishes. – Doug Stevenson Feb 07 '23 at 22:29
  • Thanks Doug, this was very helpful. Sorry that I've asked the same question but I wasn't able to find the matching answer. If it's ok for the moderators, I would like to keep the question open - depends on what they prefer – Ayrix Feb 07 '23 at 22:33

0 Answers0