Identifiers and databases

UUID v4 vs v7 for application identifiers

A practical identifier decision that separates uniqueness from secrecy and avoids database or compatibility surprises.

UUID v4 and v7 both provide large globally unique spaces, but they expose different information and behave differently in indexes. Neither format is authorization or a secret.

Choose for the access pattern

v4 is random and widely supported. v7 embeds creation time and generally improves insertion locality, but values created together are not automatically a strict global sequence.

Check storage and compatibility

Prefer native UUID columns or compact binary storage, keep one canonical text format at boundaries, and verify parsers, drivers, migrations, and API schemas before adopting v7.

Review privacy and security

v7 reveals approximate creation time; v4 does not. Both still require resource authorization, and neither should replace passwords, session tokens, or API keys.

UUID choice checklist

  • Confirm language and database support
  • Choose v4 or v7 for an explicit reason
  • Use a canonical storage format
  • Test index and migration behavior
  • Keep authorization independent from identifiers

Related guides

Learn the workflow behind this tool and what to check next.

Related tools