What is UUID v7 — time-ordered identifier
What is UUID v7: Unix time at the start of the ID, database sorting, and how it differs from random UUID v4.
UUID v7 is a UUID version whose high bits carry the creation time in Unix milliseconds, with random bits filling the rest. As a result, identifiers come out in creation order, which is convenient for sorting and time-based lookups.
The main advantage over random v4 is reduced B-tree fragmentation: new rows are appended near the end of the index instead of at random positions. This speeds up inserts on large tables and makes time debugging easier.
The ToolsHelper UUID generator supports v7 and shows the extracted time. Note that older systems may not support v7 — in that case keep v4 for compatibility.
The first 48 bits of a version 7 UUID are Unix milliseconds. That is why a list of them is roughly sorted by creation. The random tail stops two calls in the same millisecond from colliding. Reading the time does not need a key. This page defines that layout. The converter actually emits the id.
FAQ
Can I extract the time?
Yes. The UUID studio shows decoded time for v7.
Is v7 always better than v4?
Not always: v4 fits random IDs and compatibility, v7 fits indexes and sorting.
