#23518: Subquery does not respect explicit __exact
-------------------------------------+-------------------------------------
Reporter: john-parton | Owner: nobody
Type: | Status: closed
Cleanup/optimization |
Component: Database layer | Version: 1.7
(models, ORM) |
Severity: Normal | Resolution: fixed
Keywords: subquery subselect | Triage Stage: Accepted
exact |
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by john-parton):
Thanks for the feedback.
For anyone who might come back to this ticket at a later date:
The reason someone might not want to use `.get()` is because it executes
another SQL query.
`Parent.objects.filter(parent__slug='test')` is not the same query. It
uses a join instead of a subquery, and might have different performance
characteristics. Often I refactor a SQL query looking at the output of
`EXPLAIN`, and then try to recreate the query using the ORM.
--
Ticket URL: <https://code.djangoproject.com/ticket/23518#comment:5>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/069.0eea450063126262b306914e6a2ca39c%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.