Understanding UUIDs, ULIDs and String Representations

This page summarizes the projects mentioned and recommended in the original post on news.ycombinator.com

Our great sponsors
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • SaaSHub - Software Alternatives and Reviews
  • uuid7

    UUID version 7, which are time-sortable (following the Peabody RFC4122 draft)

  • To summarise the differences:

    * UUIDv6 - sortable, with a layout matching UUIDv1 for backward compatibility, except the time chunks have been reordered so the uuid sorts chronologically

    * UUIDv7 - sortable, based on nanoseconds since the Unix epoch. Simpler layout than UUIDv6 and more flexibility about the number of bits allocated to the time part versus sequence and randomness. The nice aspect here is the uuids sort chronologically even when created by systems using different numbers of time bits.

    * UUIDv8 - more flexibility for layout. Should only be used if UUIDv6/7 aren't suitable. Which of course makes them specific to that one application which knows how to encode/decode them.

    UUIDv7 is thus the better choice in general.

    (I recently wrote Python and C# implementations - https://github.com/stevesimmons/uuid7 and https://github.com/stevesimmons/uuid7-csharp)

  • uuid7-csharp

    UUIDv7 for C#. Time-ordered UUIDs with up to 50ns resolution and 48 bits of randomness.

  • To summarise the differences:

    * UUIDv6 - sortable, with a layout matching UUIDv1 for backward compatibility, except the time chunks have been reordered so the uuid sorts chronologically

    * UUIDv7 - sortable, based on nanoseconds since the Unix epoch. Simpler layout than UUIDv6 and more flexibility about the number of bits allocated to the time part versus sequence and randomness. The nice aspect here is the uuids sort chronologically even when created by systems using different numbers of time bits.

    * UUIDv8 - more flexibility for layout. Should only be used if UUIDv6/7 aren't suitable. Which of course makes them specific to that one application which knows how to encode/decode them.

    UUIDv7 is thus the better choice in general.

    (I recently wrote Python and C# implementations - https://github.com/stevesimmons/uuid7 and https://github.com/stevesimmons/uuid7-csharp)

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
  • ksuid

    K-Sortable Globally Unique IDs

  • We use K-Sortable Globally Unique IDs: https://github.com/segmentio/ksuid

    Some differences:

    128 bit strongly generated payload (instead of 80 bits for ULIDs).

    Only 32 bit time precision but that's wall clock time anyway.

    Base62 encoded.

  • tiny_id

    Rust library for generating non-sequential, tightly-packed short IDs.

  • There’s a way of using some number theory to generate a random-looking sequence of sort codes without repeating them, I wonder if they do something like that. I implemented the technique in Rust here: https://github.com/paulgb/tiny_id

  • Hashids.java

    Hashids algorithm v1.0.0 implementation in Java

  • uuid6-ietf-draft

    Next Generation UUID Formats

  • Brad Peabody did the original -00 draft, which was discussed as an FYI at an IEFT meeting in March 2020. See [1], around 50 lines from the bottom.

    Kyzer Davis has since submitted two further revisions -01 and -02 in April and October 2021. See history in [2].

    The current -02 draft is due to expire in April 2022. Presumably Kyzer Davis will try to get it discussed before then.

    The GitHub repo tracking these drafts is https://github.com/uuid6/uuid6-ietf-draft/.

    [1] https://datatracker.ietf.org/meeting/107/materials/minutes-1...

    [2] https://datatracker.ietf.org/doc/draft-peabody-dispatch-new-...

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts