#30842: Prefetch_related spends considerable time constructing querysets.
-------------------------------------+-------------------------------------
     Reporter:  Alex Aktsipetrov     |                    Owner:  nobody
         Type:                       |                   Status:  new
  Cleanup/optimization               |
    Component:  Database layer       |                  Version:  master
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     Keywords:  prefetch_related     |             Triage Stage:  Accepted
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by Alex Aktsipetrov):

 Replying to [comment:3 Simon Charette]:
 > Ideally only proxies to the original queryset would be created to defer
 the creation of querysets to only if needed.

 I think we can't really defer the creation, since such a proxy would have
 to share lots of features with the QuerySet?
 Although we probably can create a proxy to defer just filter calls.

 But instead I've tried fumbling with QuerySet itself, see the PR. That
 seems simpler from implementation perspective and also gives more control
 of copying.

 > I wonder if performing some form of local memoization per related
 manager class to call `manager._apply_rel_filters` only once manager type
 and using queryset cloning could speed up things a bit here. Happy to give
 it a broad try if that can get you started Alex.

 If you think this is a more promising approach, please do.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/30842#comment:6>
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/066.7e8f02ae95d0e110a7e4cc621acf6aef%40djangoproject.com.

Reply via email to