Unique IDs at scale
Lesson 15 of 40 · Sys.Micro
Generate millions of unique, sortable IDs per second without a central counter.
On one database, id SERIAL is perfect: 1, 2, 3… Now orders are sharded over three databases. Each has its own counter, so shard 1 and shard 2 both create order #1001.
Snowflake-style IDs: time + machine + sequence
Check yourself
Why do random UUIDs as primary keys often slow down inserts in a B-tree database?
Do it in the browser: a real system design tool, a short mission and instant feedback. No install.
Start this lesson — free