UUID version 7 (RFC 9562) packs a big-endian Unix millisecond timestamp into the leading 48 bits so IDs sort naturally by creation time. Great for database indexes: no more random-uuid B-tree fragmentation, no separate created_at needed for coarse ordering, and still collision-safe thanks to 74 bits of entropy.
128 bits total, rendered as 8-4-4-4-12 hex. The high 48 bits hold the timestamp (ms since 1970-01-01 UTC), followed by 4 bits fixed to 0111 (version 7), 12 bits of extra randomness (rand_a), 2 bits fixed to 10 (variant), and 62 bits of random rand_b. That means the first hex digit of the 3rd group is always 7, and the first hex digit of the 4th group is one of 8 9 a b.
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | unix_ts_ms | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | unix_ts_ms | ver | rand_a | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |var| rand_b | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | rand_b | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| v4 | v7 | ULID | |
|---|---|---|---|
| Sortable by time | ✘ | ✔ (ms) | ✔ (ms) |
| Bits of entropy | 122 | 74 | 80 |
| Length (rendered) | 36 | 36 | 26 (base32) |
| Standardised | RFC 9562 | RFC 9562 | Draft (Alizain 2016) |
Drop-in for existing uuid columns | ✔ | ✔ | ✘ (needs base32) |