Skip to main content
Technical Guide

UUID v4 vs. UUID v7: Which Identifier Should You Use in MySQL 8?

Why RFC 9562 time-ordered UUID v7 solves B-tree index fragmentation in relational databases compared to random UUID v4.

For years, developers choosing globally unique identifiers faced a trade-off: standard UUID v4 values are completely random (122 random bits), which causes severe B-tree page splitting and random I/O when used as clustered primary keys in MySQL InnoDB.

How UUID v7 Solves Index Fragmentation

Standardized in RFC 9562, UUID v7 places a 48-bit Unix epoch millisecond timestamp in the most significant bits, followed by 74 bits of cryptographic randomness. Because newly generated UUID v7 values are monotonically increasing over time, database inserts append cleanly to the end of the index tree while remaining globally unique across distributed nodes. Try generating both formats in our UUID Generator.

Published: 2026-10-17 ← Back to All Guides