3 ms·
In one of the examples, the author fetches results from Firebase, and then sorts them in the browser. I'm not huge on Firebase, but aren't there methods ([0]) t
by danappelxx 7y ago
In one of the examples, the author fetches results from Firebase, and then sorts them in the browser. I'm not huge on Firebase, but aren't there methods ([0]) to do this on the database, where it'd be much faster and wouldn't waste client cpu?
If this is the case, then this is a bit of faulty abstraction - your database queries are going to be more than just 'select * from <>'. I'm sure there's a way to accomplish this with react hooks without sacrificing elegance for performance.
[0]: https://firebase.google.com/docs/reference/js/firebase.database.Reference.html#orderbyvalue https://firebase.google.com/docs/reference/js/firebase.datab...
- dsaffy 7y agoYou are correct - Firebase can order server-side. I also believe I could integrate it without sacrificing elegance. At some point I'll put out a new version that takes advantage of this.
- danappelxx 7y agoLooking forward to it :)
- SkyPuncher 7y agoSome of this comes down to cost optimization. I believe Firebase charges per record returned. Having an index and sort query doubles the costs compared to client side sorting on the index.
- danappelxx 7y agoBut at the same time, what if you want to filter records? Doing it on the Firebase side saves both time and money.
- deleted 7y ago[deleted]
- socceroos 7y agoFirestore is cost per record. Firebase Realtime Database is cost for storage and bandwidth.