Hello everyone,
I’ve been fiddling with db indexes lately to improve the performance of an admin view.
Eventually I found this PR https://github.com/django/django/pull/10692 which ensures the records displayed by ChangeList
are deterministically ordered.
Among other things, the code looks for the presence of a unique_together
attribute on the Meta
class of the model to determine if the model is already totally ordered.
I was wondering if _get_deterministic_ordering()
should check for the presence of UniqueConstraint
s as well, which currently aren’t considered by the discovery algorithm.
I noticed the docs currently advise against using unique_together
in favor of UniqueConstraint
, suggesting the former may be deprecated in the future, which was the reason that prompted me to make this post
What do you think?
Thanks,
Fabio