Re:Keyset Cursors, Not Offsets, for Postgres Pagination
by millipede on Thursday December 05, 2024 @08:17PM
(#42334947)
Cursors are generally better, but they don't give any hint about how much more is in front of the cursor. I don't think there is a O(log n) algorithm to keep track of what position a given item is in a collection (k'th item out of n), which still keeps the other CRUD operations at O(log n). This would be useful to split a large, dynamically changing result set into smaller parts that can be scanned through using a cursor.
[ Parent
| on HN ]
Re:Keyset Cursors, Not Offsets, for Postgres Pagination
by lucas_codes on Friday December 06, 2024 @06:23AM
(#42338748)
If you only want a hint, in postgres you could always do an EXPLAIN and see the estimated number of rows returned