3 ms·
We chose ULID for our Postgres PK recently, and this article helped a lot in making that decision: https://brandur.org/nanoglyphs/026-ids https://brandur.org/na
by sarreph 2y ago
We chose ULID for our Postgres PK recently, and this article helped a lot in making that decision: https://brandur.org/nanoglyphs/026-ids https://brandur.org/nanoglyphs/026-ids
I personally prefer ULID since it is compat with a UUID type and you also get a timestamp lexicographically built into the ID so that sorting by ID also means sorting by timestamp. There are multiple PG extensions to make it easy to drop in and use.
- saaspirant 2y agoHow do you deal with ulid exposing the timestamp (since is lexicographically sortable) ? Maybe your ULID is not public facing? Or this is not an issue for your application? I want to use something url friendly too since uuid sucks..
- presentation 2y agoYou could probably just use random uuids and then encode/decode them to ULID whenever you read/write them.
- sarreph 2y agoI don’t have a problem with people knowing the timestamp - it’s only precise down to the second.