UUIDv7 vs ULID vs Snowflake: Distributed ID Generation Playbook

2026-03-06 · software

UUIDv7 vs ULID vs Snowflake: Distributed ID Generation Playbook

Date: 2026-03-06
Category: knowledge

Why this matters

ID format is not a cosmetic choice.

It directly affects:

If your IDs are wrong, everything built on top gets quietly expensive.


The 20-second summary


Quick format comparison

UUIDv7 (RFC 9562)

ULID (ulid/spec)

Snowflake (Twitter-style)


Decision matrix

Choose UUIDv7 if:

Choose ULID if:

Choose Snowflake if:


Operational trade-offs that actually bite

1) Clock behavior

Practical rule: define an explicit rollback policy (wait, fence, failover, or epoch bump) before production.

2) Hot-shard risk from time-ordering

Time-ordered IDs improve B-tree locality, but can increase right-edge pressure in some storage patterns.

Mitigations:

3) Text collation traps

ULID/UUID text sort assumptions can break under locale/case-insensitive collations.

Practical rule:

4) Information leakage

All three expose time semantics (directly or indirectly).

If creation-time privacy matters, do not expose raw IDs publicly without reviewing inference risk.


Production guidance (opinionated)

  1. Default to UUIDv7 for new service boundaries unless a hard 64-bit constraint exists.
  2. Store as binary in DB hot paths (text at boundaries only).
  3. Adopt monotonic strategy for same-ms bursts (counter/fraction/random hybrid acceptable per RFC guidance).
  4. Treat clock discipline as reliability work (NTP mode, drift monitoring, rollback alarms).
  5. Document decode policy: whether parsing timestamp/worker fields is allowed, and where.
  6. Load-test index behavior with your real insert concurrency and shard pattern; don’t trust folklore.

Migration notes

If you already run UUIDv4 and want better write locality:

If moving from Snowflake to UUIDv7:


One-line takeaway

For most 2026 systems, UUIDv7 is the safest default, ULID is best when human-friendly sortable strings are first-class, and Snowflake is still elite when you truly need 64-bit deterministic infrastructure IDs and are willing to own the operational sharp edges.


References

  1. IETF RFC 9562 (May 2024), Universally Unique IDentifiers (UUIDs): https://www.rfc-editor.org/rfc/rfc9562
  2. ULID canonical spec (GitHub): https://github.com/ulid/spec
  3. Twitter Snowflake archive (design notes / README): https://github.com/twitter-archive/snowflake/tree/snowflake-2010
  4. Twitter engineering announcement, Announcing Snowflake (2010): https://blog.x.com/engineering/en_us/a/2010/announcing-snowflake