Lesson 15 of 16
10. Unique ID Generation

Sources

3 min read+10 XP

Source notes

  • UUID versions 4 and 7, bit layouts: RFC 9562, "Universally Unique IDentifiers (UUIDs)", May 2024 (replaces RFC 4122). Python's standard library added uuid.uuid7() in Python 3.14 (Python documentation).
  • Snowflake: Twitter Engineering, "Announcing Snowflake", June 2010, and the original open-source project (twitter-archive/snowflake on GitHub): 41-bit timestamp, 10-bit machine ID, 12-bit sequence; refuses to generate when the clock moves backwards.
  • Ticket servers with step and offset: Flickr Code blog, "Ticket Servers: Distributed Unique Primary Keys on the Cheap", February 2010.
  • Instagram's ID scheme (41 bits time, 13 bits shard, 10 bits sequence, generated in PostgreSQL): Instagram Engineering, "Sharding & IDs at Instagram", 2012.
  • Insecure direct object reference (IDOR): OWASP guidance on broken access control.
  • Birthday-bound collision figures for UUID v4 and all other arithmetic: computed 2026-10-08.
  • Level 3 and Level 4 code: tested 2026-10-08 (code/ch10_ids.py, all checks pass).