Free preview

Approach 1: UUIDs

Why this matters: UUIDs are the reflexive answer, and they are genuinely excellent at the hard part — coordination. Understanding precisely which requirements they fail is what lets you defend using them, or not.

Key takeaway

UUIDs (universally unique IDs) are 128-bit hexadecimal numbers offering approximately 10^38 combinations. Version 4 relies on pseudorandom generation, so servers generate them independently, requiring no coordination.

How it works

Each server produces IDs on its own. An example UUID:

123e4567e89b12d3a456426614174000

This approach is scalable, highly available, and has a low collision probability — and it achieves all three by never talking to anything.

The five drawbacks

DrawbackDetail
Performance128-bit non-numeric keys slow down primary key indexing and inserts
SizeThey exceed the 64-bit size limit — twice over
FormatNon-numeric strings are unsuitable for some use cases
UniquenessThere is a small chance of duplication — minimal, but UUIDs are not deterministically unique
OrderingIDs are not monotonically increasing — no time-sortability at all

Scorecard

UniqueScalableAvailable64-bit numeric ID
Using UUID

Two out of four. Scalability and availability are perfect precisely because there is no coordination — and uniqueness and size are exactly what that freedom costs.

Key takeaway

UUIDs trade size and determinism for zero coordination. If your constraint is a 64-bit numeric key, they are disqualified on arithmetic alone — but note why they're attractive, because the next two approaches give up availability to fix it.

Interview signal by level

LevelWhat a strong answer sounds like
L4"Use UUIDs — they're unique."
L5Knows the limits: "UUIDs need no coordination, but they're 128 bits and not sortable, so they fail a 64-bit numeric requirement."
Staff+Names both sides precisely: "probabilistic rather than deterministic uniqueness, and random keys are the worst case for B-tree locality — consecutive inserts scatter across the index. But zero coordination means a partitioned server still generates valid IDs, which is a real availability property the alternatives give up."

Next: buying uniqueness by adding a coordinator.

Enjoying the preview?

Create a free account to unlock the rest of this course, the in-browser judge, and live AI mock interviews.

Sign up free to continue