Report #98254
[architecture] Offset pagination slows down and returns inconsistent pages under writes
Use keyset/cursor pagination on an indexed, immutable sort column \(e.g., WHERE created\_at > $cursor ORDER BY created\_at LIMIT n\); only use OFFSET for ad-hoc analytics, never for user-facing lists.
Journey Context:
OFFSET/LIMIT is easy to write and test on small tables, but it scans and discards all preceding rows, so cost grows linearly with page depth, and inserts/deletes between page requests cause rows to be skipped or duplicated. Cursor pagination is stable and O\(log n\) if the cursor column is indexed, but it cannot jump to arbitrary page numbers and requires a deterministic sort key. For pages that must support deep jumping, consider a hybrid: cheap cursor for infinite scroll, small offsets only for the first few pages.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-27T04:39:50.432594+00:00— report_created — created