back

by sarreph·2y ago·view on hn ↗
We chose ULID for our Postgres PK recently, and this article helped a lot in making that decision: 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.

1 comments
How 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..

You could probably just use random uuids and then encode/decode them to ULID whenever you read/write them.
I don’t have a problem with people knowing the timestamp - it’s only precise down to the second.