Hacker News new | ask | show | jobs
by Kip9000 2728 days ago
What problem does this solve? Why is it necessary to sort a unique id?
4 comments

Since the ids are generated chronologically, it means you can sort by id instead of created_at. A nice convenience for sure.
It can help operations if you know when an id came from. So that when you get a request id from a user, you don't also have to get a when.
> when you get a request id from a user

Just a public service reminder that "never trust the client" still applies, in case you were imagining user agents generating their own ULIDs to relive servers of the duty or something. Nothing prevents them from sending duplicate or out-of-order IDs.

I've always been intrigued by having clients provide the id. I think I understand why that choice is made, but it does seem unusually error fragile.
This comes out of Twitter Snowflake. The "prior art" links at the bottom are pretty informative.
Using a ULID in a Clustered index?