ULID: Universally Unique Lexicographically Sortable Identifier
Using ULID identifiers in Go programs running on Postgres database.
The UUID format is a highly popular and amazing standard for unique identifiers. However, despite its ubiquity, it can be suboptimal for many common use-cases because of several inherent limitations:
It isn’t the most character efficient or human-readable.
UUID v1/v2 is impractical in many environments, as it requires access to a unique, stable MAC address.
UUID v3/v5 requires a unique seed.
UUID v4 provides no other information than true randomness, which can lead to database fragmentation in data structures like B-trees, ultimately hurting write performance.
Introducing the ULID Identifier
Few projects I worked on used the ULID (Universally Unique Lexicographically Sortable Identifier), and I really enjoyed working with it, and would love to share this experience with you. Specifically for Go programs using Postgres database. But the same applies to other languages or databases too.
You can find the full spec here - github.com/ulid/spec
ulid() // 01ARZ3NDEKTSV4RRFFQ69G5FAV


