ULID
ULID (Universally Unique Lexicographically Sortable Identifier) is a 128-bit identifier format designed to be globally unique, sortable by time, and encoded in a URL-safe, case-insensitive string. It combines a 48-bit timestamp (milliseconds since Unix epoch) with 80 bits of randomness, ensuring uniqueness across distributed systems while maintaining chronological ordering. ULIDs are often used as alternatives to UUIDs when time-based sorting is required.
Developers should use ULIDs when they need identifiers that are both globally unique and sortable by creation time, such as in database primary keys, distributed system logs, or event sourcing architectures. They are particularly useful in scenarios where chronological ordering matters, like sorting database records or tracking events in a timeline, while avoiding the non-sortable nature of UUIDs. ULIDs also offer better performance in indexing and querying compared to random UUIDs due to their time-prefixed structure.