Keyset Pagination
ELI5 — The Vibe Check
Keyset pagination is cursor-based pagination's more explicit cousin. Instead of an opaque cursor, you use actual column values (like 'give me everything with an ID greater than 500 and created after Tuesday'). It's deterministic, efficient on large datasets, and doesn't degrade as you go deeper — unlike OFFSET which makes your database cry on page 10,000.
Real Talk
Keyset pagination (also called seek pagination) uses WHERE clause conditions on indexed columns to fetch the next page of results. It requires a deterministic sort order and uses the last row's values as the seek point. It maintains O(log n) performance regardless of depth, unlike OFFSET which degrades linearly.
When You'll Hear This
"Keyset pagination on our 10-million-row table returns in 2ms regardless of page depth." / "OFFSET 100000 scans and discards rows; keyset pagination seeks directly to the right spot."
Related Terms
Cursor-Based Pagination
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 th
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.
SQL (Structured Query Language)
SQL is the language you use to talk to a database. You ask it things like 'give me all users who signed up this week' and it actually does it.