Firebase Team AMA
View other answers to this threadtry getting better every day
How to minimize document reads in a collection if you have frequent multi item searches?
That's kinda hard to say without knowing a little more about the searches you're performing, but I will say:
- If you're performing frequent searches, expect to have frequent document reads. That's just going to be a fact of life
- Consider adding limits to your queries and paginating your results -- make sure your client isn't retrieving more records than your users actually need. This can be especially important when the size of your collections grow.
- I'm assuming you're asking because of cost, and my general advice here is to beware prematurely optimizing for price. I've seen a lot of really gnarly code on StackOverflow where developers have spent hours creating unstable solutions that are really hard to debug in order to save, like, 10 cents a day. Obviously, you want to avoid doing really bad things like reading in an entire collection when you don't need to, but remember that your time costs money too!