Hacker News new | ask | show | jobs
by djbusby 1248 days ago
I use ULID, 128 bits, time and great sorting

https://github.com/ulid/spec

2 comments

Wrote about my experience using ulids in Postgres if people are considering it: https://blog.lawrencejones.dev/ulid/
Good post thanks :)
Is there any way to have the database generate these automatically vs your application?
The common databases don't support natively support generating ULIDs to my knowledge. You can usually find extensions if you prefer generating them in the database instead of the application. I generate them in the application, and store them as a UUID in PostgreSQL to avoid needing any database extensions.
Yea, there are a few extensions for PG, in C and Go that give a ulid_create() function that can be used as column default, just like serial.