databasefirebasefirebase-realtime-databasereal-timerecords

How many records / rows / nodes is a lot in Firebase?


I'm creating an app where I will store users under all postalcodes/zipcodes they want to deliver to. The structure looks like this:

postalcodes/{{postalcode}}/{{userId}}=true

The reason for the structure is to easily fetch all users who deliver to a certain postal code.

ex. postalcodes/21121/

If all user applies like 500 postalcodes and the app has about 1000 users it can become a lot of records:

500x1000 = 500000

Will Firebase easily handle that many records in data storage, or should I consider a different approach/solution? What are your thoughts?

Kind regards, Elias


Solution

  • I'm quite sure Firebase can return 500k nodes without a problem.

    The bigger concerns are how long that retrieval will take (especially in this mobile-first era) and what your application will show your user based on that many nodes.

    A list with 500k rows is hardly useful, so most likely you'll show a subset of the data.

    1. Say you just show the first screenful of nodes. How many nodes will that be? 20? So why would you already retrieve the other nodes already in that case? I'd simply retrieve the nodes needed to build the first screen and load the rest on demand - when/if needed.
    2. Alternatively I could imagine you show a digest of the nodes (like a total number of nodes and maybe some averages per zip code area). You'd need all nodes to determine that digest. But I'd hardly consider it to task of a client application to determine the digest values. That's more something of a server-side task. That server could use the same technology as client-apps (i.e. the JavaScript API), but it wouldn't be bothered (as much) by bandwidth and time constraints.

    Just some ideas of how I would approach this, so ymmv.