News for hackers. Stuff that matters.
Re:Paginating Requests in APIs (2020) by gabetax on Saturday May 28, 2022 @01:07PM (#31541935)
Check https://use-the-index-luke.com/no-offset as a better reference.

But in most SQL databases, cursors are something you implement and parse at the application layer, and translate to a WHERE clause on the (hopefully indexed) column you're ordering on. That turns the O(N) "OFFSET" into a O(log(n)) index seek.

Re:Paginating Requests in APIs (2020) by lazide on Saturday May 28, 2022 @05:29PM (#31544047)
Many databases have actual cursor implementations which are transactional. That means you’ll get a consistent view at the point in time you created the cursor.

That said, they tend to live only as long as the db connection (with some exceptions), so yeah you need some application work to make it sane.

Re:Paginating Requests in APIs (2020) by nafey on Saturday May 28, 2022 @02:16PM (#31542470)
How is a cursor different from key set in that case?
Re:Paginating Requests in APIs (2020) by cdash on Saturday May 28, 2022 @02:58PM (#31542749)
It's not in that case, cursors can be implemented however you want though. Its an abstraction, that prevents you from having to change the schema of the API when you change the implementation.