Across distributed databases featuring thousands of sharded tables, central auto-increment sequences create an insurmountable choke point. Conversely, adopting randomly generated UUIDv4 strings shatters B-Tree page locality in PostgreSQL and MySQL InnoDB, leading to massive write amplification and index fragmentation.
1. The Twitter Snowflake 64-Bit Architecture
The Snowflake algorithm produces k-sortable 64-bit integer identifiers with clear bit partitioning:
- 1 bit: Unused sign bit (fixed at 0).
- 41 bits: Epoch Millisecond Timestamp (providing ~69 years of lifespan).
- 10 bits: Node/Machine ID (supporting up to 1024 unique generator nodes).
- 12 bits: Sequence Number (enabling 4096 unique IDs per millisecond per node).
Throughput exceeds 4 million IDs per second per machine with zero network round trips or inter-node locking.
Advertisement / Sponsored