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
Prevented unnecessary distinct() call in SearchFilter. #3938
Prevented unnecessary distinct() call in SearchFilter. #3938
Conversation
50ef329
to
1ada749
Compare
Looks like a very promising change. Thanks for work ! |
|
||
def must_call_distinct(self, opts, lookups): | ||
""" | ||
Return True if 'distinct()' should be used to query the given lookups. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps a link here to the Django WONTFIX ticket, or documentation, or similar?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's undergoing work to allow using subqueries to filter m2m but I'm unsure about which ticket you are referring to. This was mostly inspired by how the Django's admin handle a similar case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm unsure about which ticket you are referring to.
No, I'm not sure either - I thought I'd remembered a django ticket referring to this that closed as WONTFIX
, but I don't see anything like that now.
Current coverage is 91.49%
|
Great stuff, thanks! |
Calling distinct can have disastrous performance impact. This patch makes sure we only call it if required.