The Evolution of Unique Identifiers: UUID v4 vs UUID v7
Universally Unique Identifiers (UUIDs) are indispensable in modern microservice architectures, distributed databases (PostgreSQL, MySQL, CockroachDB, MongoDB), and cloud event buses. They allow independent systems to generate non-colliding primary keys without communicating with a centralized database sequence generator.
While **UUID v4** has long been the standard for cryptographically random keys, its lack of ordering creates severe B-Tree index fragmentation and disk page splits in relational databases. **UUID v7** (RFC 9562) solves this by prefixing the 128-bit structure with a 48-bit millisecond timestamp, providing sequential, time-ordered database indexing while preserving global uniqueness.
