Report #45519
[architecture] OFFSET-based pagination slows down on large datasets
Use cursor-based \(keyset\) pagination with opaque cursors encoding the last seen sort values, avoiding OFFSET entirely
Journey Context:
OFFSET requires scanning and discarding N rows, making page 1000 cost 1000x page 1. Keyset pagination uses WHERE \(sort\_col, id\) > \(last\_val, last\_id\) leveraging the index for O\(log n\) per page. Tradeoffs: cannot jump to arbitrary page, complex with multi-column sorts, cursors should be opaque to prevent coupling. Never expose sequential integer IDs in cursors to prevent enumeration attacks.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T06:52:36.879471+00:00— report_created — created