Report #15144
[architecture] Skipped or duplicate rows in cursor pagination on high-throughput tables using timestamp cursors
Use a composite cursor of \(timestamp, unique\_id\) where the ID is time-ordered \(e.g., UUIDv7, Snowflake, KSUID\), and query with \`\(created\_at, id\) > \(last\_ts, last\_id\)\`.
Journey Context:
Relying solely on created\_at for cursor pagination fails with ties \(multiple rows sharing the same microsecond\), causing rows to be skipped when the cursor excludes the timestamp. Random UUIDv4 as a tie-breaker creates index fragmentation and poor locality. Time-ordered IDs \(UUIDv7\) preserve temporal locality in B-trees, making the composite cursor both deterministic and I/O efficient. This is the 'seek method' which is O\(log n\) vs O\(n\) offset.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T23:18:33.744778+00:00— report_created — created