Skip to content

Cursor-Based Pagination

Medium — good to knowBackend

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."

Made with passive-aggressive love by manoga.digital. Powered by Claude.