#28477: Strip unused annotations from count queries
-------------------------------------+-------------------------------------
     Reporter:  Tom Forbes           |                    Owner:  Tom
         Type:                       |  Forbes
  Cleanup/optimization               |                   Status:  assigned
    Component:  Database layer       |                  Version:  master
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:  Accepted
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  1
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by Reupen Shah):

 Just a note to say that the behaviour I was describing was rectified in
 https://github.com/django/django/pull/11062.

 The third case from above now executes the following SQL query:

 {{{
 SELECT COUNT(*) FROM (
     SELECT CONCAT("people_person"."first_name", CONCAT(' ',
 "people_person"."last_name")) AS "full_name" FROM "people_person"
 ) subquery
 }}}

 Although the original ticket was about eliminating unneeded annotations
 completely, the result above is good enough for me, as the group by has
 been eliminated which was the real performance killer.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/28477#comment:11>
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/061.b2341b4e81a7e803838c69b39ed81c54%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to