UUID v7 Generator — Time-Sortable UUIDs
Quick Answer: UUID v7 embeds a Unix timestamp in the first 48 bits, making UUIDs sortable by creation time. This dramatically improves database index performance compared to random UUID v4, especially in PostgreSQL and MySQL B-tree indexes.
FAQ
What is UUID v7?
UUID v7 (RFC 9562) uses a millisecond-precision Unix timestamp followed by random bits. The format is time-ordered, meaning UUIDs sort chronologically.
When should I use v7 instead of v4?
Use v7 for database primary keys (better index locality), event IDs (natural time ordering), and any case where chronological sorting is useful.