#35947: prefetch_related makes duplicate queries for the same records by 
different
relations
-------------------------------------+-------------------------------------
     Reporter:  Jake Douglas         |                    Owner:  (none)
         Type:                       |                   Status:  closed
  Cleanup/optimization               |
    Component:  Database layer       |                  Version:  5.1
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:  wontfix
     Keywords:                       |             Triage Stage:
                                     |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Comment (by Jake Douglas):

 The example code I provided is not from our application, it's just a
 simplification that demonstrates the behavior. Most occurrences of
 duplicate prefetch queries in our application do not involve denormalized
 relations.

 The quoted query stats ''are'' from a request in our application and were
 intended to demonstrate that this behavior is not rare, but I realize the
 greater context is missing: almost all of the duplicate queries are coming
 from `prefetch_related`, with some queries being issued 20+ times for the
 most commonly prefetched relations in this request.
-- 
Ticket URL: <https://code.djangoproject.com/ticket/35947#comment:4>
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 visit 
https://groups.google.com/d/msgid/django-updates/010701936fc5765e-5d0f4e83-56bf-4c47-ab3d-75d4b23de42b-000000%40eu-central-1.amazonses.com.

Reply via email to