#17668: prefetch_related does not work in in_bulk
-------------------------------------+-------------------------------------
     Reporter:  gurets@…             |                    Owner:  nobody
         Type:  Uncategorized        |                   Status:  new
    Component:  Database layer       |                  Version:
  (models, ORM)                      |  1.4-alpha-1
     Severity:  Normal               |               Resolution:
     Keywords:  prefetch_related,    |             Triage Stage:  Accepted
  in_bulk                            |      Needs documentation:  0
    Has patch:  0                    |  Patch needs improvement:  0
  Needs tests:  0                    |                    UI/UX:  0
Easy pickings:  0                    |
-------------------------------------+-------------------------------------
Changes (by akaariai):

 * cc: anssi.kaariainen@… (added)
 * needs_better_patch:   => 0
 * needs_docs:   => 0
 * needs_tests:   => 0
 * stage:  Unreviewed => Accepted


Comment:

 The problem is anything using the .iterator() of qs will not do the
 prefetching. This should be documented, as there is no possibility to both
 yield object at a time, and do prefetching. Maybe also an assert in the
 iterator about this would be warranted. Another option is to force the
 whole query to be iterated over and then doing the prefetch when calling
 .iterator() and using .prefetch_related() in the same query.

 Marking as accepted. Maybe this should be a release blocker?

-- 
Ticket URL: <https://code.djangoproject.com/ticket/17668#comment:1>
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 post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to