0

Assumptions: I have a database of about 1 million entries in Firebase. Every entry is structured the same. They have a creation date and 5 other boolean attributes: attribute A, B, C, D, E, and date.

Question: What is the best way to return a list of the 20 most recent entries that have attribute A==true and D==false?

It appears this cannot be done with stock features in Firebase. Is it possible to do this with BigQuery or some other service?

  • If you're querying a Firebase list of 1 million items to retrieve the 20 most recent ones, you're doing it wrong. As with most NoSQL solutions, Firebase's queries are relatively poor at such scenarios. But even if they weren't: you'd be asking the database to do a lot of work that isn't needed. See my answer here: http://stackoverflow.com/questions/39712833/firebase-performance-how-many-children-per-node/39713060#39713060 – Frank van Puffelen Feb 17 '17 at 02:19
  • Thank you for the reply Frank. I don't think I can structure my data that way. The application I'm using this for is a doll selector. Customers can choose from a set of options for a doll. We would like to show the most recent dolls made with that feature. There are over 20 options to choose from. It makes it difficult to structure the data in such a way that we can quickly show recent dolls with those attributes. – Boulderbuff64 Feb 17 '17 at 08:09
  • It sounds like selecting from categories. Something like the structure I mentioned here might work: http://stackoverflow.com/questions/40656589/firebase-query-if-child-of-child-contains-a-value – Frank van Puffelen Feb 17 '17 at 14:47

0 Answers0