Developer
•
Dec 17, 2025
•
6 دقيقة قراءة
UUID v4 vs ULID vs Snowflake: Picking an ID Format
Random UUIDs are universal but unsorted. ULIDs and Snowflakes are sortable. The choice changes your database indexes.
UUID v4 is random — 122 bits of entropy, collision probability practically zero. Drawback: unsorted, so primary key indexes are full of B-tree rebalancing. ULID (Universally Unique Lexicographically Sortable Identifier) embeds a timestamp prefix so records sort chronologically — ideal as a database PK. Snowflake (Twitter's scheme) packs timestamp + machine ID + sequence into 64 bits — designed for distributed systems that need both sortability and a smaller ID. Our UUID Generator emits v4; for ULID/Snowflake reach for a library.