Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firebase database bandwidth usage when read with Query

I'm using Firebase in my android app, and I've noticed that the app use a lot of bandwidth. I execute only read in the lower nodes childs like stated in the best practise to save bandwidth.

If I execute a query like this:

Query queryRef = firebaseRef.orderByChild("internalKey").equalTo(false);
queryRef.addListenerForSingleValueEvent(new ValueEventListener()
        {
           ...

In the database bandwidth usage are counted all the child node or only those with internalKey = false?

like image 730
Blodhgard Avatar asked Dec 06 '25 10:12

Blodhgard


1 Answers

The bandwidth counts the amount of data that you upload and download. It's really as simple as that.

If you have defined an index on internalKey, then Firebase will filter the data on its servers and return only the elements matching the condition.

However, if you don't have an index on internalKey, all the data will be downloaded to the client and the client will then do the filtering. You should also see a warning about that in logcat iirc.

When you see large bandwidth usage, I recommend enabling debug logging (Firebase.getDefaultConfig().setLogLevel(Level.DEBUG)) and checking if the traffic in logcat matches your expectation.

like image 140
Frank van Puffelen Avatar answered Dec 07 '25 23:12

Frank van Puffelen



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!