RFC 9562 Standard · B-Tree Optimized · Chronologically Sortable
UUIDv7 Generator
Generate RFC 9562 UUIDv7 identifiers with embedded millisecond timestamps. Prevent database B-tree index fragmentation while maintaining global uniqueness.
Generated UUIDv7 (Chronologically Ordered & B-Tree Friendly):
RFC 9562 48-bit Unix Epoch
Why UUIDv7 Is Replacing UUIDv4 for Database Primary Keys
The B-Tree Index Fragmentation Problem with UUIDv4
UUIDv4 consists of 122 purely pseudo-random bits. When used as a primary key in relational databases (PostgreSQL, MySQL InnoDB, SQLite), new records are inserted at completely random positions throughout the clustered B-Tree index.
As tables grow past RAM cache limits, this randomness causes excessive page splits, cache misses, and massive I/O amplification. In contrast, UUIDv7 puts a 48-bit Unix timestamp at the most significant bits, ensuring new records always append to the end of the index with minimal disk writes.
UUIDv7 Structure & RFC 9562 Specification
RFC 9562 allocates the 128 bits of a UUIDv7 as follows:
- Bits 0-47 (48 bits):
unix_ts_ms- Epoch time in milliseconds. Valid until year 10,889. - Bits 48-51 (4 bits): Version field set to
0111(7). - Bits 52-63 (12 bits): Sub-millisecond sequence counter or random entropy.
- Bits 64-65 (2 bits): Variant field set to
10(RFC 4122/9562). - Bits 66-127 (62 bits): Cryptographically secure pseudo-random bits.