Report #5357
[architecture] Choosing between UUIDv4 and auto-incrementing IDs for distributed systems primary keys
Use UUIDv7 \(sortable, timestamp-based\) as default for new tables. Store as binary\(16\) or native UUID type. Avoid UUIDv4 for high-write tables due to B-tree index fragmentation and page splits.
Journey Context:
UUIDv4 is random causing B-tree index splits and poor page locality \(bad buffer cache performance\). Auto-increment creates write hot spots and prevents horizontal partitioning. UUIDv7 embeds Unix timestamp in high bits providing sortability like ULIDs but with IETF standard format. Tradeoff: slightly less entropy in clock bits vs v4, but negligible for most use cases; not suitable if you need completely non-guessable IDs without additional entropy.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-15T21:08:56.193731+00:00— report_created — created