4 ms·
So cursor pagination is just keyset pagination, except instead of using a column value directly you use an opaque string that gets translated back to a column v
by SPBS 4y ago
So cursor pagination is just keyset pagination, except instead of using a column value directly you use an opaque string that gets translated back to a column value. So you can modify how the cursor gets translated back to a column value anytime without breaking API compatibility.
That said I'm not sure if everyone agrees on that definition, from what I know people do consider keyset pagination and cursor pagination to basically mean the same thing.
- richbell 4y ago> So cursor pagination is just keyset pagination, except instead of using a column value directly you use an opaque string that gets translated back to a column value. HashIds is a popular solution if those columns are numerical or can be represented numerically (e.g. timestamp). https://hashids.org/ https://hashids.org/
- bmn__ 4y agoCompare with: <https://datatracker.ietf.org/doc/html/draft-peabody-dispatch-new-uuid-format#page-4 https://datatracker.ietf.org/doc/html/draft-peabody-dispatch...>
- noneeeed 4y agoI thinks that’s what the article is saying. I found the descriptions didn’t really explain the differences very well. We use a cursor that combines the sort key and normally the ID as a secondary sort and pointer value, otherwise you can’t paginate through data where the sort column has duplicates. We don’t really do much to obfuscate these, but we don’t document the structure and people who try to tweak the values won’t get far.
- giaour 4y agoOne advantage of opaque cursors is that they can include information that's not part of your public API. For instance, if you allow soft deletes and do not return deleted items in the list, you can end up with a massive stretch of deleted items separating two live results. You can leave a note in the cursor indicating what record was last scanned, and that's not possible in keyset pagination.
- ignaciochiazzo 4y agoHey thanks for the feedback. I will update the article.