Firebase Load from a shallow=True get request.

Hi,

I have about 100,000 keys in a firebase path.  Those keys themselves have a lot of data in them so I only want to retrieve the keys themselves. 

When I do a shallow=True get request it is often quite slow and the database load shoots up dramatically by at least 50% (actually its more).

 

I created a new empty firebase database. And I tried to do the same but this time all the 100,000 keys point to just an integer.  Now a shallow=True get request for these keys its almost instant (1s or so). And the load is much less (only 15% or so).

 

My question is does the shallow=True load depend on other factors like how many other operations are happening on the database or the volume of data that those keys point to?

 

Thanks.

 

0 1 109
1 REPLY 1

Hello @RobertIrvine,

Welcome to the Google Cloud Community!

As you mentioned, the overall database load can indeed impact the performance of any query, including those with shallow=true. If there are many concurrent reads and writes happening simultaneously, it can slow down your specific query. Moreover, while shallow=true avoids retrieving child data, it still needs to process each key to determine if it exists. If each key has a lot of data associated with it, even a simple existence check can be resource-intensive. In your case, replacing the data with integers significantly reduced the processing time for each key. So, in conclusion, yes, you are right. The performance of shallow=true queries does depend on several factors.

For more information: Retrieving Data