Cursor-Based Pagination
ELI5 — The Vibe Check
Cursor-based pagination is like using a bookmark instead of a page number. Instead of saying 'give me page 47,' you say 'give me the next 20 items after this specific item.' This means if new items are added while you're browsing, you won't see duplicates or skip items. It's how infinite scroll actually works properly.
Real Talk
Cursor-based pagination uses an opaque cursor (typically an encoded record identifier) to mark the position in a result set. The client requests items after/before a cursor rather than using page offsets. This approach is consistent under concurrent modifications, performs well on large datasets, and is used by APIs like GitHub, Stripe, and Slack.
When You'll Hear This
"We switched from offset pagination to cursors and eliminated the duplicate item bug." / "Cursor-based pagination uses an index scan — it's O(1) regardless of how deep you paginate."
Related Terms
Infinite Scroll
Infinite Scroll loads more content as you scroll down, like a bottomless pit of data. Social media feeds use it to keep you scrolling forever.
Keyset Pagination
Keyset pagination is cursor-based pagination's more explicit cousin. Instead of an opaque cursor, you use actual column values (like 'give me everything wi
Offset Pagination
Offset pagination is the classic 'skip X rows and give me the next Y rows' approach. Page 3 of 20 results means skip 40 rows and give me 20.