Why US Backend Teams Are Migrating Primary Keys from UUID v4 to UUID v7
UUID v4 relies on 122 purely random bits. While collision resistance is astronomical, inserting completely random primary keys into clustered database B-trees (such as PostgreSQL, MySQL InnoDB, or SQL Server) scatters page writes across disk and bloats indexes at scale.
Ratified in RFC 9562, UUID v7 embeds a 48-bit Unix timestamp in milliseconds at the start of the 128-bit value, followed by 74 cryptographically random bits. You get global uniqueness without sacrificing sequential database write locality.