We can't find the internet
Attempting to reconnect
Something went wrong!
Hang in there while we get back on track
How UUID v7 works?
UUID version 7 provides a time-ordered value derived from the Unix Epoch timestamp, along with improved entropy characteristics. It is recommended over versions 1 and 6 when possible.
UUID v7 Structure
The 128-bit UUID v7 is organized as follows:
xxxxxxxx-xxxx-7xxx-yxxx-xxxxxxxxxxxx
- xxxxxxxx-xxxx: 48-bit Unix Epoch timestamp (milliseconds since midnight, 1 Jan 1970 UTC, leap seconds excluded).
- 7: Version number (7).
- y: Value ensuring RFC 4122 variant.
- xxxxxxxxxxxx: Remaining bits with random data.
UUID v7 Generation
- Create Timestamp: Utilize the Unix Epoch timestamp in milliseconds as the starting point.
- Set Version and Variant: Bits set to 0110 for version 7, and the variant according to RFC 4122.
-
Generate Random Values: Create
rand_a
andrand_b
, totaling 74 bits of pseudo-random data, for increased uniqueness. - Assemble UUID: Combine the fields to form the 128-bit UUID.
Benefits of UUID v7
- Time-Sortable: Uses a widely-accepted timestamp source, ensuring natural time-based sorting.
- Improved Uniqueness: The inclusion of 74 bits of random data ensures a higher level of uniqueness.
- Compatibility: Encourages use over previous time-based versions 1 and 6.