Report #40973
[architecture] Using standard UUIDv4 as primary keys causes index bloat and write amplification
Adopt UUIDv7 \(or ULID\) which are time-ordered; they improve index locality, reduce page splits, and preserve k-sortability while maintaining uniqueness. Use bigint only if global uniqueness isn't required.
Journey Context:
UUIDv4 is random, causing inserts to scatter across B-tree indexes \(PostgreSQL/MySQL\), leading to page splits, high write amplification, and poor cache locality. Sequential IDs leak business volume and complicate distributed systems. UUIDv7 \(RFC 9562\) encodes a Unix timestamp in the high bits, giving the locality of sequential IDs with the uniqueness of UUIDs. ULID is a pre-existing binary-compatible alternative. Avoid 'COMB' GUIDs; they are non-standard. Benchmarks show 50%\+ insert throughput improvement on SSDs under high concurrency.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T23:14:45.651007+00:00— report_created — created