—
UUID v4 vs v7
UUID v4 is 122 bits of random data, essentially zero collision probability for any practical use. UUID v7 encodes the current Unix timestamp in milliseconds in the first 48 bits, making it naturally sortable (ideal for database primary keys where index locality matters). Both formats follow the standard 8-4-4-4-12 hex grouping. When inserting large volumes of rows, v7's time-ordering avoids the B-tree page splits that random v4 UUIDs cause, improving write throughput significantly.