Free preview

Comparing All Seven Approaches

Why this matters: the scorecard is the artifact to carry out of this chapter. Being able to reproduce it — and explain why each cell is what it is — is the whole deliverable.

Key takeaway

No approach is best in every column. Range handler wins on uniqueness without ordering; Snowflake is the practical choice when you need both; TrueTime is the only clean sweep, and it costs hardware most organizations cannot justify.

The complete scorecard

ApproachUniqueScalableAvailable64-bit numeric IDCausality maintained
Using UUID
Using a database
Using a range handler
Using UNIX time stampsweakweak
Using Twitter Snowflakeweak
Using vector clocksweakcan exceed
Using TrueTime

Choosing in practice

SituationChooseWhy
No size constraint, want zero coordinationUUIDNothing to depend on; a partitioned server still generates valid IDs
Need compact unique keys, ordering irrelevantRange handlerAll four requirements, amortized coordination
Need compact, unique, and roughly time-sortableSnowflakeThe practical default — good enough ordering at no coordination cost
Need provable causality in a small clusterVector clocksOnly approach that detects concurrency without special hardware
Need strict external consistency, have the budgetTrueTimeBounded, explicit uncertainty

For most systems the answer is Snowflake or a Snowflake variant. It is the design that trades a weak causality guarantee — good enough for feeds, tracing, and last-write-wins — for compactness, throughput, and zero coordination.

Six lessons that generalize

LessonDetail
Duplicates are dangerousDuplicate identifiers can cause critical errors — duplicate payments, for instance
Probabilistic vs deterministicUUIDs offer probabilistic uniqueness; deterministic uniqueness often requires slower consensus mechanisms
Size costs throughputLarge keys slow down database updates; identifiers should be compact
IDs leak informationRandom bits prevent external parties from guessing business metrics such as order volume
Counters aren't freeSimple counters are faster than timestamps but require persistent storage, creating bottlenecks and SPOFs
Sortable IDs create hotspotsMonotonically increasing IDs create hotspots in distributed databases like Spanner, reducing performance

Key takeaway

Every column in the scorecard trades against another: size against causality, ordering against hotspots, determinism against coordination. The design skill is knowing which guarantee your system actually needs and refusing to pay for the rest.

Interview signal by level

LevelWhat a strong answer sounds like
L4Names one approach and stops.
L5Compares a few: "UUIDs are too big, a central database is a SPOF, so Snowflake — compact and time-sortable."
Staff+Walks the progression and prices the guarantee: "each approach fixes the last one's failure. Snowflake is the practical answer because strict global ordering needs consensus, and Spanner reports around 100 ops/sec for that — two orders of magnitude below what we need. So I'd take weak ordering deliberately."

Next: the whole thing under interview conditions.

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