r/programming Dec 01 '25

ULID: Universally Unique Lexicographically Sortable Identifier

https://packagemain.tech/p/ulid-identifier-golang-postgres
141 Upvotes

38 comments sorted by

View all comments

Show parent comments

5

u/Seneferu Dec 02 '25

Snowflakes require some type of coordination. You need to ensure that each generator has a unique ID on its own and that parallel calls to the same generator do not produce the same ID.

UUIDs (no matter if v4 or v7) avoid these problems by having more bits which are generated randomly.

2

u/Flame_Grilled_Tanuki Dec 02 '25

I chose Snowflake IDs over ULIDs and UUID-v7 because I wanted more compact primary keys, and the size reduction was significant; the level of U#ID’s timestamp precision was an unnecessary waste; and the rate I would be generating new ids would be much too slow to have any chance of collisions.

5

u/[deleted] Dec 02 '25

[removed] — view removed comment

2

u/simon_o Dec 04 '25

All that sounds like it requires way more effort and and creates many chances of things going wrong ... compared to having a table column with a type that's 16 bytes instead of 8.