[12.x] Switch models to UUID v7#52433
Merged
Merged
Conversation
Member
|
It seems like that Postgres tweet is referring to unsorted v4 UUIDs. I'm not sure sorted V4 to sorted V7 migration would show same performance gains? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Based on #52029, I'm proposing to switch the
HasUuidstrait to UUID v7.This change is similar to the reverted #44210 but addresses its privacy concerns: While #44210 switched all UUIDs to v7, this PR only targets model UUIDs and they already contain a timestamp in the current implementation.
v7 is a standardized format, while the UUIDs generated by
Str::orderedUuid()at the moment are only a custom variant of the v4 standard.At least on PostgreSQL, v7 UUIDs also seem to perform much better.
Upgrade
This is a breaking change for users of the trait that rely on the sortability of UUIDs. The affected models need to continue generating UUIDs with
Str::orderedUuid(). I added a legacyHasVersion4Uuidstrait because that's the most convenient solution, IMO.I removed the
HasVersion7Uuidstrait from #52029 because it's redundant now. We could also deprecate it and remove it later.