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

[Uid] Add a caution message about using UUIDs as primary keys #19783

Merged
merged 1 commit into from
Apr 15, 2024

Conversation

javiereguiluz
Copy link
Member

Fixes #19705.

@javiereguiluz javiereguiluz added this to the 6.4 milestone Apr 12, 2024
@carsonbot carsonbot changed the title Add a caution message about using UUIDs as primary keys [Uid] Add a caution message about using UUIDs as primary keys Apr 12, 2024
@seb-jean
Copy link
Contributor

And for ULIDs ?

@javiereguiluz
Copy link
Member Author

@seb-jean I updated the PR with another caution about ULIDs. Thanks.

Using UUIDs as primary keys is usually not recommended for performance reasons:
indexes are slower and take more space (because UUIDs in binary format take 128 bits
instead of 32/64 bits for auto-incremental integers) and the non-sequential nature of
UUIDs fragments indexes. UUID v7 is the only variant that solves the fragmentation
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WDYT to add anchor link on UUUD v7 ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea! I did this while merging. Thanks.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

UUIDv6 are also fine from a fragmentation PoV

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've updated the docs here: 2cbc55e Thanks!

@javiereguiluz javiereguiluz merged commit 63e4578 into symfony:6.4 Apr 15, 2024
3 checks passed
@javiereguiluz javiereguiluz deleted the fix_19705 branch April 15, 2024 06:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants