#24296: clear select fields for `.exists()` of distinct, non-sliced querysets
----------------------------------------------+--------------------
     Reporter:  outofculture                  |      Owner:  nobody
         Type:  Cleanup/optimization          |     Status:  new
    Component:  Database layer (models, ORM)  |    Version:  1.7
     Severity:  Normal                        |   Keywords:
 Triage Stage:  Unreviewed                    |  Has patch:  0
Easy pickings:  0                             |      UI/UX:  0
----------------------------------------------+--------------------
 The fix (93cc6dcdac6fc3e506640fa38dd1798c3cd61cff) for bug #18414
 introduced an inefficiency in `.exists()` on distinct querysets in that
 now all distinct querysets are selecting all their fields. I propose the
 fields should be left on the queryset only if `(q.distinct and
 (q.high_mark is not None or q.low_mark is not None))`.

 As I started writing the test for this, I realized I would have to inspect
 the query itself, which seems... like a bad idea for a test. Would this be
 reasonable to submit the (one-line-change) patch without a test, or does
 someone have a suggestion for a way to make the test that's less brittle?

--
Ticket URL: <https://code.djangoproject.com/ticket/24296>
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/055.b1bbbdc28c37e6dfe608a1d00bcb3197%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to