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

Deprecate in favor of UUIDv7 #91

Open
booch opened this issue Oct 2, 2023 · 13 comments
Open

Deprecate in favor of UUIDv7 #91

booch opened this issue Oct 2, 2023 · 13 comments

Comments

@booch
Copy link

booch commented Oct 2, 2023

I just read about UUIDv7. It's a proposed IETF standard, in "last call". Other than the base32 encoding, it's got everything we want from ULID. UUIDv7 will be more widely accepted and available to developers.

I propose that we declare victory, and allow the UUID spec to take over the effort from here on.

@booch
Copy link
Author

booch commented Oct 2, 2023

See #85 for some additional discussion.

@peterbourgon
Copy link

ULIDv7 has weaker rules for each part of the ID, and sacrifices 4 bits of entropy to a static version identifier. It's different enough that I don't think it makes sense to "deprecate" ULIDs.

@arokettu
Copy link

arokettu commented May 2, 2024

4 bits

6 bits. Still, UUIDv7 solves some ULID issues like predictability of the monotonic factory, and UUIDs being better supported in databases in general

@peterbourgon
Copy link

ULIDs don't have predictable monotonicity unless generated as such, and database support is a red herring 🤷

@arokettu
Copy link

arokettu commented May 2, 2024

ULIDs don't have predictable monotonicity unless generated as such

ULID spec is unclear about that (#80) but some implementations are monotonic by default in spec-described unsafe way (like symfony/uid)

database support is a red herring 🤷

It's not, it's the reason I'm no longer using ULIDs for new projects

@peterbourgon
Copy link

peterbourgon commented May 2, 2024

ULIDs and UUIDs are represented in databases identically: as 128bit numbers both.

Whether or not IDs have monotonic entropy is opt-in by the producer. And whether or not predictable monotonicity is a problem is a function of use case (it is not always a problem).

@arokettu
Copy link

arokettu commented May 2, 2024

ULIDs and UUIDs are represented in databases identically: as 128bit numbers both.

If stored in binary, you can't manually query a ULID given its string. With UUID even without db support you can simply remove dashes and query as a raw hex

@fabiolimace
Copy link

You all probably already know, but just in case, RFC 9562 was published a few days ago (May 7, 2024). RFC 4122 is obsolete and UUIDv7 is now official.

https://www.rfc-editor.org/rfc/rfc9562
https://datatracker.ietf.org/doc/rfc9562

@liquidcarbon
Copy link

ULIDs and UUIDs are represented in databases identically: as 128bit numbers both.

If stored in binary, you can't manually query a ULID given its string. With UUID even without db support you can simply remove dashes and query as a raw hex

They start as 128 bits but in practice UUIDs inevitably end up as raw 36 char strings, annoying AF. ULIDs are shorter by 10 chars and still mean something

@bbrtj
Copy link

bbrtj commented Aug 1, 2024

Exactly, string encoding of ULID is superior to UUID.

@arokettu
Copy link

arokettu commented Aug 2, 2024

and still mean something

I don't understand this argument

Exactly, string encoding of ULID is superior to UUID

You can encode UUID to Base32 too if you want. Converting UUIDv7 to Base32 even makes it a valid ULID

@sydbarrett74
Copy link

ULIDv7 has weaker rules for each part of the ID, and sacrifices 4 bits of entropy to a static version identifier. It's different enough that I don't think it makes sense to "deprecate" ULIDs.

Just for clarity, confirming that you probably meant UUIDv7.

@jpickwell
Copy link

ULIDs and UUIDs are represented in databases identically: as 128bit numbers both.

If stored in binary, you can't manually query a ULID given its string. With UUID even without db support you can simply remove dashes and query as a raw hex

PostgreSQL has a built-in uuid column type that hides the value's binary storage. You can query using the string representation of a UUID without sacrificing the binary storage of the UUID. For ULIDs, you could store them as uuid and just do a trivial conversion to/from UUID when querying the DB.

As for the lack of DB support, ULIDs can be trivially converted to hex just like UUIDs, so whatever your argument is, it's moot.

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

8 participants