Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

They're snowflake IDs, not exactly sequential.

Timestamp bits, shifted all the way left Data center id shifted left Server id shifted left Increment this millisecond

Since the left bits are the timestamp, they are date/time sortable and a much more useful index/primary key/whatever than a UUID.



You can prefix the uuid with a timestamp for the same effect without leakage. There are chronological uuid projects: https://github.com/uucid-project/spec


You can, but why would you? You're advocating slapping lipstick on a pig not really engineered for this use case vs. using something that was designed for it.

UInt64's are going to be all around more efficient.


You wouldn't, just showing that it's an easy problem to solve.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: