Almanac of UUIDs · Part VII
The Modern Standards (RFC 9562)
In May 2024, the IETF ratified RFC 9562, formally obsoleting RFC 4122. This new standard addresses the database locality problem by standardizing time-ordered UUIDs.
7.1 UUID Version 6: Reordered Gregorian Time
Purpose: Version 6 is a transitional format. It is bit-compatible with Version 1 but modifies the field order to be sortable.
- v1 Order: Low - Mid - High (Bad sorting)
- v6 Order: High - Mid - Low (Correct sorting)
Use Case: Use v6 only if you have an existing database populated with v1 UUIDs and need to migrate to a sortable format without losing the ability to decode the original timestamps. For new applications, use v7.
7.2 UUID Version 7: Unix Epoch Time
Purpose: Version 7 is the new industry standard for database keys. It combines the locality of sequential integers with the global uniqueness of UUIDs.
| Field | Bits | Content |
|---|---|---|
| unix_ts_ms | 48 | Unix Timestamp (ms). Big-Endian sorting. |
| ver | 4 | Version 7 (0111). |
| rand_a | 12 | Random (or counter for sub-ms precision). |
| var | 2 | Variant 10. |
| rand_b | 62 | Random data. |
Monotonicity:v7 supports "monotonicity" during high-frequency bursts. If multiple UUIDs are generated within the same millisecond, the implementation creates a sequence by incrementing the random bits. This guarantees that UUID(t) < UUID(t+1) even at nanosecond scales.
7.3 UUID Version 8: Custom
Purpose:Version 8 provides an "escape hatch" for vendor-specific implementations that still want to adhere to the valid UUID RFC structure.
- Fixed: Version bits (1000) and Variant bits (10).
- Free: The remaining 122 bits are entirely custom.
Use Cases: Sharding (embedding a Tenant ID), or testing new hashing algorithms (e.g., BLAKE3) before standardization.
References & Further Reading
- RFC 9562: Universally Unique IDentifiers (UUIDs) — RFC Editor
- RFC 9562 History & Status — IETF Datatracker
- draft-ietf-uuidrev-rfc4122bis-14 — Previous Draft
- Discussion on UUID Collisions — GitHub
- UUIDv6, UUIDv7, and UUIDv8; what are they?
- New UUID Formats (Draft Site)