#29725: Inefficient SQL generated when counting a ManyToMany
-------------------------------------+-------------------------------------
     Reporter:  Gavin Wahl           |                    Owner:  ontowhee
         Type:                       |                   Status:  assigned
  Cleanup/optimization               |
    Component:  Database layer       |                  Version:  dev
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:  Accepted
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  1                    |  Patch needs improvement:  1
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Comment (by ontowhee):

 I'm not sure if this is a viable solution. It passing the
 `ManyRelatedManager` to the queryset as an instance variable
 `_many_related_queryset`.

 [https://github.com/django/django/pull/17811 Draft PR]

 > No need to as at that point it will be a QuerySet

 I briefly looked into `QuerySet._query` to see if a new optimized sql
 query could be generated when the `aliasMap` lists certain table types. I
 ended up passing the `ManyRelatedManager` to get something working. I'm
 open to exploring a different approach.
-- 
Ticket URL: <https://code.djangoproject.com/ticket/29725#comment:26>
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018d6de84e6f-405949fe-0855-413c-ac7d-7bd7650ae12f-000000%40eu-central-1.amazonses.com.

Reply via email to