Report #100588
[architecture] Offset pagination becomes slow and inconsistent — what's the fix?
Use cursor \(keyset\) pagination for large, real-time, or sorted lists. Encode the last seen value of the sort key as an opaque cursor; the next page starts after that value. Avoid offset when rows are inserted or deleted while paginating.
Journey Context:
OFFSET is simple and works in SQL tutorials, but it scans and discards all prior rows, so cost grows linearly with page depth. Worse, if the dataset changes between page requests, items shift and users see duplicates or skipped rows. Cursor pagination uses the index on the sort key to seek directly to the next position, giving stable O\(log n\) performance and consistent snapshots. The downside is you can't jump to an arbitrary page number, so use offset only for small, static admin lists.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-07-02T04:45:23.459086+00:00— report_created — created