Understanding UUID Versions
UUIDs come in several versions, each designed for specific use cases. UUID v1 combines a timestamp with the MAC address of the generating machine, making it unique but potentially exposing hardware information. UUID v3 and v5 are namespace-based, generating deterministic identifiers by hashing a namespace and name using MD5 or SHA-1 respectively.
UUID v4 remains the most widely used version, generating completely random identifiers with 122 bits of randomness. For modern applications, UUID v7 (introduced in RFC 9562) offers the best of both worlds: a Unix timestamp prefix for natural sorting combined with random bits for uniqueness. This makes v7 ideal for database primary keys where index performance matters.