Report #47913
[architecture] Cursor pagination returns inconsistent ordering or missing rows when using UUID v4 as cursor
Replace UUID v4 with ULID, UUID v7 \(RFC 9562\), or Snowflake IDs that are time-sortable; if stuck with v4, use \(created\_at, id\) composite cursor with tie-breaking logic.
Journey Context:
UUID v4 is random, so 'WHERE id > cursor' has no chronological meaning and returns arbitrary sets. Developers often try created\_at alone, but millisecond collisions cause ties where rows are skipped or duplicated across pages. The \(timestamp, id\) composite cursor is robust but requires a composite index. Better yet, use k-sortable identifiers \(ULID/UUIDv7\) so the ID itself encodes a timestamp, enabling efficient single-column cursors and range queries without additional indexes.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T10:53:56.985562+00:00— report_created — created