Opened 4 years ago
Closed 4 years ago
#31785 closed Cleanup/optimization (invalid)
Documentation suggesting using UUIDField as a good alternative for primary_key, without inviting to consider performance drawbacks
Reported by: | Remy | Owned by: | nobody |
---|---|---|---|
Component: | Documentation | Version: | 3.0 |
Severity: | Normal | Keywords: | uuid uuidfield |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
In the documentation section regarding UUIDFields (https://docs.djangoproject.com/en/3.0/ref/models/fields/#uuidfield), we have:
Universally unique identifiers are a good alternative to AutoField for primary_key
However the question of whether UUIDs make good primary keys regarding to performance appears to be debated: https://www.percona.com/blog/2019/11/22/uuids-are-popular-but-bad-for-performance-lets-discuss/
What is the take of the community regarding that?
In any case if there is doubt, having mention of that in the documentation should be considered.
Note:
See TracTickets
for help on using tickets.
The DevelopersMailingList is the appropriate venue for this kind of question/discussion.
There was some discussion of this here: https://groups.google.com/d/topic/django-developers/VFXZpHnuEJc/discussion which led to #31007.
I cannot recall exactly what the consensus opinion on using UUID PKs was. (I've certainly done it in the past without experiencing particular issues but...)
Will close as invalid for now, since the mailing list is the place for it, but happy to re-open/accept if there's a consensus reached.
Thanks.