Report #11743
[architecture] Offset pagination performance degrades on large datasets \(deep pagination\)
Implement keyset pagination \(cursor-based\) using the last seen value of an indexed column \(e.g., WHERE \(created\_at, id\) > \($1, $2\)\) instead of OFFSET.
Journey Context:
OFFSET requires the database to scan and discard N rows, making it O\(offset\) complexity, which fails at page 10,000\+ \(queries may take seconds or minutes\). Keyset pagination uses an index seek on the last seen tuple, remaining O\(log n\) regardless of depth. Tradeoffs: cannot jump to arbitrary page numbers, cannot easily get total count, requires stable sort columns \(tie-breaker ID needed for non-unique timestamps\).
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T14:13:13.068208+00:00— report_created — created