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.

FieldBitsContent
unix_ts_ms48Unix Timestamp (ms). Big-Endian sorting.
ver4Version 7 (0111).
rand_a12Random (or counter for sub-ms precision).
var2Variant 10.
rand_b62Random 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.