UUID v7: Time-Ordered UUIDs for Better Database Performance
Explore UUID v7, the new time-ordered format that improves database indexing. Compare with v4 and ULID for distributed system identifiers.
Published:
Tags: developer-tools, uuid, v7
UUID v7: Time-Ordered UUIDs for Better Database Performance UUID v4 is random by design. That randomness is excellent for privacy and collision avoidance, but terrible for database B-tree indexes: every insert lands at a random position in the index tree, causing constant page splits and poor cache utilization. UUID v7 solves this by embedding a millisecond-precision Unix timestamp at the front of the UUID, making new UUIDs naturally sort to the end of the index — just like auto-increment integers, but with the global uniqueness of a UUID. UUID v7 Structure UUID v7 is defined in RFC 9562 (published April 2024). The 128-bit layout: Bits 0–47: 48-bit Unix timestamp in milliseconds (big-endian) Bits 48–51: Version field = (7) Bits 52–63: — 12 bits of random or sub-millisecond precision data…
All articles · theproductguy.in