UUID v7 Generator
Generate one or many UUID v7 values at once. The leading 48 bits hold a millisecond timestamp, so plain string sorting gives creation order. Pick the count, the time and monotonicity.
Result
No results yet
Set a count in advanced options and press generate
About UUID v7
Why v7 instead of v4
All 122 bits of a v4 UUID are random, so its value tells you nothing about when it was created. Used as a primary key, every insert lands at an arbitrary position in the index and the B-tree splits pages to make room. In v7 the leading bits are time, so new values always append near the end of the index, concentrating writes and improving cache hit rate.
What Earliest and Latest are for
They are the smallest and largest UUIDs that can exist within a given millisecond, produced by filling the random portion with all zeros or all ones. This lets you run range queries over time using only the primary key index, with no separate timestamp column.
- Earliest
019fadde-f095-7000-8000-000000000000 - Latest
019fadde-f095-7fff-bfff-ffffffffffff WHERE id BETWEEN earliest(t1) AND latest(t2)
Latest ends in bfff rather than ffff because the two variant bits are fixed at 10, capping that nibble at b.
Byte boundaries do not line up with field boundaries
The binary view above makes this visible. Byte 6 (7a) is split between version and rand_a, and byte 8 (9c) is split between variant and rand_b. The hex form hides this entirely.
Caveats
- The creation time can be read back out of the UUID. Do not use v7 where exposing that timestamp matters.
- Generating more than 4,096 values in a single millisecond exhausts the counter and rolls into the next millisecond.
- If the system clock steps backwards, monotonicity breaks. RFC 9562 leaves the handling to the implementation.
Reference: RFC 9562 §5.7, §6.2