Pagination
also: cursor pagination · keyset pagination
Returning a big result set in bounded pages instead of all at once — cursor-based beats offset at scale.
Pagination is returning a large result set in smaller pages rather than all at once, so responses stay bounded in size and latency. The two main styles are offset-based (page N, skip N times size rows) and cursor / keyset-based (give me items after this id).
Worked example: a feed API returns 20 items plus a cursor; the client sends the cursor back to get the next 20 — the query uses WHERE id > cursor ORDER BY id LIMIT 20, which stays fast no matter how deep you go. Gotcha: offset pagination (OFFSET 100000) degrades badly — the database still scans and discards all skipped rows — and can skip or duplicate items when the data changes between pages; cursor pagination avoids both but cannot jump to an arbitrary page number.