What is the difference between UUID v4 and UUID v7?
UUID v4 is completely random (122 random bits), which causes random B-tree page splits and index fragmentation in relational databases. UUID v7 (RFC 9562) embeds a 48-bit Unix millisecond timestamp in the most significant bits, making IDs naturally time-ordered (k-sortable) for high-performance PostgreSQL and MySQL primary keys.