What is UUID v7?
Version 7 is the new standard for time-based UUIDs (defined in RFC 9562). It combines a Unix timestamp (with millisecond precision) and random data to create an identifier that is both globally unique and monotonically increasing (sortable).
Key Features
- Time-ordered: Insertions into B-tree databases are sequential, reducing fragmentation and improving performance.
- Standardized: The official successor to v1 and non-standard approaches like ULID.
- No Privacy Leaks: Unlike v1, it does not include a MAC address.
When to use UUID v7?
Use Version 7 for database primary keys or any scenario where you need sortable identifiers. It is widely considered the best default choice for modern applications, replacing both v1 and v4 for database usage.