#21760: prefetch_related uses an inefficient query to get the related fk data
-------------------------------------+-------------------------------------
     Reporter:  valtron2000@…        |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  Database layer       |                  Version:  1.6
  (models, ORM)                      |               Resolution:
     Severity:  Release blocker      |             Triage Stage:  Accepted
     Keywords:  prefetch_related     |      Needs documentation:  0
  ForeignKey                         |  Patch needs improvement:  0
    Has patch:  1                    |                    UI/UX:  0
  Needs tests:  0                    |
Easy pickings:  0                    |
-------------------------------------+-------------------------------------

Comment (by loic84):

 We discussed this issue with @akaariai on IRC.

 Like we did for #21410, we'll take a practical approach for fixing the
 regression from Django 1.6 to master and go for the proposed fix. It's
 worth noting that the inefficient query will still be present for
 multicolumn relations, but these are not documented and one needs to use
 private APIs to make them, so that doesn't qualify as a regression.

 The implementation of
 `ReverseSingleRelatedObjectDescriptor.get_prefetch_queryset()` really
 ought to be cleaned up at some point, especially when we land the patch
 for composite fields but it'll require a fair amount of refactoring so it
 only qualifies for master.

 @valtron2000, would you mind updating the patch?

 - The "FIXME" comment would have to be updated to explain this the new
 case with a reference to this ticket.
 - The current test is pretty fragile, could you rather check in QS.query
 if there is a join?

 Feel free to open a PR on github.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/21760#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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/079.6886e232904bd683747ea57f417fb40b%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to