Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

would ulid be better then snowflake id? #65

Open
VincentRPS opened this issue Mar 18, 2022 · 3 comments
Open

would ulid be better then snowflake id? #65

VincentRPS opened this issue Mar 18, 2022 · 3 comments

Comments

@VincentRPS
Copy link

would ulid be better/more unique than a twitter snowflake and why?

@mholt
Copy link

mholt commented Oct 5, 2022

I don't really know anything about this (as I'm just discovering ULIDs myself) but it seems to me that snowflakes require a machine ID, which has the same problems as UUID v1 and v2. If the machine ID isn't universally unique, then the resulting snowflake won't be either.

@andrewlalis
Copy link

A little late to the party, but...

  • A snowflake indeed requires some sort of machine/node id for each generator, while ULID doesn't.
  • A snowflake id is 8 bytes (a long datatype in most languages), which can be convenient. ULID is 16 bytes, or 26 chars, so it can store many more values while still offering the same general promise of monotonicity, albeit not always 100% accurate if two ids are generated within the same millisecond of each other, but that usually doesn't matter in practice.

@VincentRPS
Copy link
Author

A little late to the party, but...

  • A snowflake indeed requires some sort of machine/node id for each generator, while ULID doesn't.
  • A snowflake id is 8 bytes (a long datatype in most languages), which can be convenient. ULID is 16 bytes, or 26 chars, so it can store many more values while still offering the same general promise of monotonicity, albeit not always 100% accurate if two ids are generated within the same millisecond of each other, but that usually doesn't matter in practice.

It seems that snowflake id may be more ideal then, even if it requires some sort of machine/node id that could always just be set to the name of the thread your using in your language or something. Or well as long as you don't care about having to use BigInts or Longs everywhere instead of normal integers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants