Report #5366
[architecture] Implementing pagination that degrades performance on large tables
Use keyset pagination \(cursor-based\) with last-seen column values instead of OFFSET. Require deterministic sort key \(composite if needed: created\_at \+ id\).
Journey Context:
OFFSET scans and discards N rows, causing O\(n\) cost increasing linearly with page number and inconsistent result sets under concurrent modifications \(items shift between pages\). Keyset pagination \(WHERE \(created\_at, id\) > \(last\_created\_at, last\_id\)\) uses index efficiently with O\(log n\) cost regardless of page depth. Tradeoff: Cannot jump to arbitrary page number \(only next/previous\), requires unique sortable column\(s\), complex with multi-column sorting, difficult to show total count efficiently. Use OFFSET only for small tables \(<10k rows\) or first few pages.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-15T21:09:56.261373+00:00— report_created — created