#16937: Prefetch related objects
-------------------------------------+-------------------------------------
     Reporter:  lukeplant            |                    Owner:  nobody
         Type:  New feature          |                   Status:  new
    Component:  Database layer       |                  Version:  1.3
  (models, ORM)                      |               Resolution:
     Severity:  Normal               |             Triage Stage:  Accepted
     Keywords:                       |      Needs documentation:  0
    Has patch:  0                    |  Patch needs improvement:  1
  Needs tests:  0                    |                    UI/UX:  0
Easy pickings:  0                    |
-------------------------------------+-------------------------------------

Comment (by akaariai):

 About the concerns of speed and memory usage because of `QuerySet`
 caching: I now think that this is not a problem, if in future
 prefetch_related will be extended in a way that you can avoid the caching.
 For example:
 {{{
 Book.objects.prefetch_related(R('authors', to_attr='authors_prefetched'))
 }}}
 Now you will have authors in an ordinary list, accessible in
 book.authors_prefetched. This way you will gain the no related manager
 memory usage and speed when needed, while in the normal cases you can use
 the convenient .prefetch_related('authors') and use the related
 manager.all().

 That being said, I don't have any problems any more with the extensibility
 of the API, or with the implementation where the objects are accessible
 through related_manager.all(). Once the patch is updated with the minor
 corrections + the dict_join.diff patch I think this will be ready for
 commit.

 I would like to work already on the custom `QuerySet` / other
 extensibility issues so that it could be included already in 1.4. Should I
 create a new ticket or is it too early? Or of course if Luke Plant has
 plans already for this work I am more than happy just to be a reviewer.

 Sorry for being a bit insistent about the extensibility /
 related_manager.all() issues. At least there is hope the discussion has
 been useful for future work.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/16937#comment:19>
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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to