#26194: WHERE EXISTS / WHERE NOT EXISTS clause without using QuerySet.extra
-------------------------------------+-------------------------------------
     Reporter:  john-parton          |                    Owner:  nobody
         Type:  Uncategorized        |                   Status:  closed
    Component:  Database layer       |                  Version:  1.9
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:  duplicate
     Keywords:  QuerySet.extra       |             Triage Stage:
                                     |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by charettes):

 * resolution:  invalid => duplicate


Comment:

 I'm not sure the query can be considered equivalent given the `LEFT JOIN`
 will return duplicate rows for parent with multiple children.

 `Parent.objects.filter(child=None).distinct()` should return the same
 results but I wouldn't be surprised if it performed worse than the
 original `EXISTS` query.

 I'll re-close as duplicate of #25789 instead.

--
Ticket URL: <https://code.djangoproject.com/ticket/26194#comment:3>
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.5cb4ef7ced05ed8e1794e3b0359ee8fa%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to