Skip to content
Commitwise
Menu

Snowflake ID

Also called: Snowflake

A 64-bit, time-sortable ID built from a timestamp, a worker number and a per-millisecond sequence.

Definition

Each machine generates IDs on its own: 41 bits of milliseconds since a custom epoch, 10 bits of worker id and 12 bits of sequence, about 4,096 IDs per millisecond per worker. IDs sort by creation time and fit in a long, but worker ids must be unique and the generator must refuse to run if the clock moves backwards.

In practice

Order ids that sort by time and can be generated by any instance without asking a central database.

Learn it in context

Lessons that use this term.

Related terms

Esc

Type to search the whole site.