Once you define an index on timeStamp
, a sort/filter action will be performed on Firebase's servers and thus not need to download all data to your application code.
The time this takes on the server is dependent on the amount of data in the index, but it's not O(n) - it's typically much better. In general most of the performance of your queries will depend on the bandwidth needed to transfer the data to your application, much more than the size of the list.
There is a scalability impact of the size of the list, but that's not explicitly defined (and has improved over the years). I typically recommend not ordering/sorting lists of more than a couple of hundreds of thousands of nodes, although I've seen cases over 1m or more nodes also work (depending on the data size).
If you want a solution where the amount of data in the location has no impact on the performance of queries, consider using Cloud Firestore. This database guarantees that the time it takes to get data only depends on the size of the data you retrieve, not on the amount of data that is considered. So that's O(1) performance, which is pretty uncommon.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…