UUIDv4 generates identifiers from randomness. This spreads new values throughout an index, which can cause page splits and cache misses. In contrast, UUIDv7 is time-ordered: its high bits encode a timestamp, clustering inserts near the end of the index for better locality and natural sorting by creation time.
For analytics and event streams, v7 simplifies time-sorted operations. For privacy-sensitive contexts, v4 avoids leaking creation time. Collision risk is negligible for both when implemented correctly. Many systems can migrate by accepting both formats during a transition and backfilling existing records.
Try: UUID generator, Random