SKBLu
  • Communities
  • Create Post
  • Create Community
  • heart
    Support Lemmy
  • search
    Search
  • Login
  • Sign Up
Otter@lemmy.ca to Programming@programming.devEnglish · 1 year ago

8 versions of UUID and when to use them

www.ntietz.com

external-link
message-square
19
link
fedilink
91
external-link

8 versions of UUID and when to use them

www.ntietz.com

Otter@lemmy.ca to Programming@programming.devEnglish · 1 year ago
message-square
19
link
fedilink
TIL: 8 versions of UUID and when to use them | nicole@web
www.ntietz.com
external-link
alert-triangle
You must log in or # to comment.
  • thanks_shakey_snake@lemmy.ca
    link
    fedilink
    arrow-up
    39
    arrow-down
    2
    ·
    1 year ago

    They should make the versions UUIDs instead of integers so that we don’t make assumptions about their ordinal relationships.

    • kibiz0r@midwest.social
      link
      fedilink
      English
      arrow-up
      2
      ·
      1 year ago

      Or maybe an abbreviated hash of the text of their specifications?

    • RonSijm@programming.dev
      link
      fedilink
      arrow-up
      1
      ·
      1 year ago

      Yea, should have been V-00000000-0000-0000-0000-000000000008 instead

      • .:\dGh/:.@lemmy.ml
        link
        fedilink
        arrow-up
        1
        ·
        1 year ago

        Yes and no. They had to put the version identifier somewhere to avoid sorting problems or parsing problems, so I think that putting somewhat in the middle is a good tradeoff.

  • breakingcups@lemmy.world
    link
    fedilink
    arrow-up
    14
    arrow-down
    1
    ·
    1 year ago

    A lot of people in this thread who don’t fully understand how UUIDs work…

    • atzanteol@sh.itjust.works
      link
      fedilink
      English
      arrow-up
      3
      ·
      1 year ago

      You’re not kidding.

  • Zikeji@programming.dev
    link
    fedilink
    English
    arrow-up
    11
    arrow-down
    3
    ·
    1 year ago

    Reject UUID embrace ULID.

    • 𝙲𝚑𝚊𝚒𝚛𝚖𝚊𝚗 𝙼𝚎𝚘𝚠@programming.dev
      link
      fedilink
      arrow-up
      12
      ·
      1 year ago

      At the company I work at we use UUIDv7 but base63 encoded I believe. This gives you fairly short ids (16 chars iirc, it includes lowercase letters) that are also sortable.

      • RonSijm@programming.dev
        link
        fedilink
        arrow-up
        1
        ·
        1 year ago

        base63? I’d guess you’d mean base64?

        Anyways, doesn’t that fuck with performance?

        I’m using this in production: RT.Comb - That still generates GUIDs, but generates them sequential over time. Gives you both the benefits of sequential ids, and also the benefits of sequential keys. I haven’t had any issues or collisions with that

        • 𝙲𝚑𝚊𝚒𝚛𝚖𝚊𝚗 𝙼𝚎𝚘𝚠@programming.dev
          link
          fedilink
          arrow-up
          1
          ·
          1 year ago

          It’s Base62 actually, misremembered that. It’s to avoid some special characters iirc. And no, performance is fine.

          We’re using this: https://github.com/TheArchitectDev/Architect.Identities

      • shotgun_crab@lemmy.world
        link
        fedilink
        arrow-up
        1
        ·
        1 year ago

        I’ll be borrowing that little trick

        • 𝙲𝚑𝚊𝚒𝚛𝚖𝚊𝚗 𝙼𝚎𝚘𝚠@programming.dev
          link
          fedilink
          arrow-up
          2
          ·
          1 year ago

          https://github.com/TheArchitectDev/Architect.Identities

          Here’s the package one of our former developers created. It has some advantages and some drawbacks, but overall it’s been quite a treat to work with!

    • Gamma@beehaw.org
      link
      fedilink
      English
      arrow-up
      2
      ·
      1 year ago

      Interesting 👀 https://github.com/ulid/spec

    • bitfucker@programming.dev
      link
      fedilink
      arrow-up
      2
      ·
      edit-2
      1 year ago

      I prefer CUID

      Just to clarify: Yes, I do know not all use cases are appropriate for CUID. But in general when generating ID, I’d use CUID2

    • Aux@lemmy.world
      link
      fedilink
      arrow-up
      1
      ·
      1 year ago

      I vote for nanoid.

  • icerunner_origin@startrek.website
    link
    fedilink
    arrow-up
    1
    arrow-down
    11
    ·
    1 year ago

    There is an IETF standard for UUIDs? Do we need an IETF standard for UUIDs? I’ve been coding since the '90s and never thought a UUID to be complicated or contentious enough to need a standard. I guess it makes for a pretty unique icebreaker to say you’ve contributed to an IETF standard, if you get invited to those sort of parties.

    • atzanteol@sh.itjust.works
      link
      fedilink
      English
      arrow-up
      17
      ·
      1 year ago

      If you’re generating UUIDs from different languages, libraries, etc. you want to be sure there doing it the same way.

      • icerunner_origin@startrek.website
        link
        fedilink
        arrow-up
        8
        ·
        1 year ago

        My face, screaming in horror, but in words instead. I’ve only really worked with projects in homogenous languages on the application side, so hadn’t considered that. Thanks for taking the time to reply.

        • DeprecatedCompatV2@programming.dev
          link
          fedilink
          arrow-up
          1
          ·
          1 year ago

          Look the issues with java.util.UUID and Postgres.

Programming@programming.dev

programming@programming.dev

Subscribe from Remote Instance

Create a post
You are not logged in. However you can subscribe from another Fediverse account, for example Lemmy or Mastodon. To do this, paste the following into the search field of your instance: !programming@programming.dev

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person’s post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you’re posting long videos try to add in some form of tldr for those who don’t want to watch videos

Wormhole

Follow the wormhole through a path of communities !webdev@programming.dev



Visibility: Public
globe

This community can be federated to other instances and be posted/commented in by their users.

  • 444 users / day
  • 1.44K users / week
  • 3.02K users / month
  • 5.11K users / 6 months
  • 1 local subscriber
  • 21.1K subscribers
  • 1.16K Posts
  • 9.99K Comments
  • Modlog
  • mods:
  • snowe@programming.dev
  • Ategon@programming.dev
  • MaungaHikoi@lemmy.nz
  • UlrikHD@programming.dev
  • BE: 0.19.12
  • Modlog
  • Instances
  • Docs
  • Code
  • join-lemmy.org