7
Awlex
6y

Fucking Google firebase database has no equivalent of 'SELECT * FROM shitheads LIMIT 10, 10'.
Better download those first 20 elements!

Descending order? haha. Fuck you.
Add your own custom index for that shit!

Comments
  • 1
    Well it is a nosql database with some very specific design goals.

    And since it always use a local replica limiting the query might actually not be faster than to do it in your own code.

    And if so it would add extra complexity that might be unnecessary.

    But I only read the docs briefly and could have missed something.

    But pagination is supposed to be done by using startat along with order and limitfirst.

    https://stackoverflow.com/questions...
  • 1
    @Voxera
    I am aware of that, but my situation is different.
    I store my user posts with a date when it was posted. So if I order the posts by that, I'll get the user posts frok oldest to newest.
    I can fetch the newest ones by using limitlast.

    But what do I do if the user wants to access the 2nd page immediately? All i can do is use an ugly hack that will download (elements per page) * 2.

    But seriously, implement a range function or a descending order is not that hard
  • 1
    @Awlex with the level of scalability it can be.

    After digging deep into sql server indexing I have a huge respect for database developers and the problems they have to solve.

    But yes the limitations can be a hassle.

    Best advice is to try not to think like with sql at all.

    Also, with startat you last item in the list, order by date and limitfirst 10 (or what your page is) and with an index on date you should be getting nice pagination.

    And it will have the benefit of not showing the same 10 if another 10 new posts arrived between the first page and the second.
Add Comment