packagemain.tech

packagemain.tech

ULID: Universally Unique Lexicographically Sortable Identifier

Using ULID identifiers in Go programs running on Postgres database.

Alex Pliutau's avatar
Alex Pliutau
Dec 01, 2025
∙ Paid

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
User's avatar

Continue reading this post for free, courtesy of Alex Pliutau.

Or purchase a paid subscription.
© 2026 Aliaksandr Pliutau · Privacy ∙ Terms ∙ Collection notice
Start your SubstackGet the app
Substack is the home for great culture