UUID v7 - Time-Sortable UUIDs
UUID v7 leads with a 48-bit Unix millisecond timestamp, so IDs sort by creation time and append cleanly to B-tree indexes - the modern default for database keys.
How this version compares with the other six - and when each one earns its keep - is covered in UUID versions explained.
When to Use This Version
Use UUID v7 for database primary keys where time-ordering improves index performance, event sourcing, audit logs, distributed tracing, and any scenario combining uniqueness with chronological sorting. V7 is the modern replacement for v1 and v6.
Best Practices
V7 is excellent for B-tree indexes - new IDs append rather than scatter. The 48-bit timestamp supports dates through year 10889. Sub-millisecond ordering uses random bits, so IDs within the same millisecond aren't guaranteed sequential. Compare with ULID if you need Base32 encoding (26 chars vs 36).