Reputation: 1170
I have a list of users, assume 10k.
Now if I run a query like below:
query = FirebaseDatabase.getInstance().getReference().child("users")
.orderByChild(SELECTED_QUERY)
.limitToFirst(150);
Will it consume bandwidth of 150 users' data
or 10k users' data
?
This question may be silly, but I haven't found expected answer.
Upvotes: 0
Views: 48
Reputation: 599956
Whether the SDK retrieves all users
or just the first 150 depends on whether you've defined an index on SELECTED_QUERY
. Without an index the SDK will retrieve all of users
and filter locally on the client; with the index the filtering will happen on the server.
Given your comment, you'll need to add an index to your rules like this:
{
"rules": {
...
"users": {
...
".indexOn": "name"
}
}
}
Upvotes: 2