Get the latest tech news

ULIDs and Primary Keys (2022)


Not all non-sequential primary keys are created equal, the ULID format is a fantastic substitute for the typical UUIDv4 choice.

Because UUIDs encode version and variant information inside the label, they can be reliably decoded into their composite parts (e.g. timestamp and randomness). UUIDs are also the perfect choice if you're writing some apocalypse-scenario software (assuming you have a working computer) as they can continue to be generated until 10,889AD compared to UUIDv7s measly 4,147AD death date. I wanted a simple ULID PostgreSQL implementation without the complexity of the monotonic counter that generated a UUID data typed value.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of ULIDs

ULIDs

Photo of Primary Keys

Primary Keys