Free preview

Requirements for Unique Identifiers

In one line: these four requirements are the scorecard. Every approach in this chapter gets marked against them, and the comparison table that results is the most useful artifact here.

The four requirements

RequirementWhat it demands
UniquenessAssign distinct identifiers to every event — not probably distinct, distinct
ScalabilityGenerate at least one billion unique IDs per day
AvailabilityEvents can occur at the nanosecond level; the system must generate IDs for all of them
64-bit numeric IDRestrict length to 64 bits for efficient storage and indexing

Why 64 bits is enough

The arithmetic, which is worth being able to do live:

Total numbers available        = 2^64  = 1.8446744 * 10^19

Estimated events per day       = 1 billion   = 10^9
Events per year                = 365 billion = 365 * 10^9

Years to deplete the range     = 2^64 / (365 * 10^9)
                               ~= 50.54 million years

64 bits provide sufficient longevity for the system.

Why do this calculation out loud

It takes fifteen seconds and it converts an arbitrary-seeming constraint into a justified one. "64 bits" stops being a number someone picked and becomes "enough for fifty million years at a billion a day, which is comfortably beyond any horizon we care about."

It also sets up the contrast that arrives in Lesson 8: Snowflake spends only 41 of those bits on time and gets 69 years, because the remaining bits are doing other work. Having the 64-bit budget in mind makes that trade legible.

Reading the scorecard

Each approach in this chapter is scored against these four (and later a fifth, causality maintained). The table grows as the chapter progresses:

UniqueScalableAvailable64-bit numeric ID
The target

Nothing satisfies all four until Lesson 5. Watching each approach fail a specific column is the fastest way to understand why the next one exists.

Key takeaway

Four requirements, and the binding one is size. A 64-bit budget is what forces the design to choose between coordination and cleverness.

Interview signal by level

LevelWhat a strong answer sounds like
L4"It needs to be unique and scalable."
L5Quantifies: "a billion a day, 64-bit so it indexes efficiently as a primary key."
Staff+Identifies the binding constraint: "the size limit is what makes this hard — without it UUIDs solve everything. I'd confirm the limit exists before designing, because it changes the answer entirely. And 64 bits at a billion a day is fifty million years, so we're not constrained by exhaustion."

Next: the obvious solution, and why it fails.

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