#25230: Change to Query.get_count() causes big performance hit
-------------------------------------+-------------------------------------
     Reporter:  dexity               |                    Owner:  nobody
         Type:                       |                   Status:  new
  Cleanup/optimization               |
    Component:  Database layer       |                  Version:  1.8
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:  Accepted
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by akaariai):

 The above queries are identical because the distinct isn't actually doing
 anything. It won't be doing anything if we can guarantee there is some
 unique column in the query. For example, when there are no joins and the
 primary key of the main table is included in the query, then the distinct
 is redundant. We could be even smarter and detect when there are no
 multivalued joins in the query (and the pk is present).

 Not sure how much trouble we should push to fixing this - the original
 distinct in the query is redundant, so it could be removed from the query
 in the reporter's application, at least for the count query.

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

Reply via email to