#35442: N+1 queries from RelatedManager + only("pk")
-------------------------------------+-------------------------------------
     Reporter:  REGNIER Guillaume    |                    Owner:  nobody
         Type:  Uncategorized        |                   Status:  closed
    Component:  Database layer       |                  Version:  4.2
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:  duplicate
     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 Simon Charette):

 Accessing objects though a related manager should still allow for `only`
 to work as expected. The fact that the ORM doesn't even warn you when it
 silently issues queries on field deferral leaks (#22492) makes this
 behavior really insidious and prevents sage usage of related managers as
 Guillaume brought up.

 I think the the ORM should either have `RelatedManager.only` include the
 reverse field implicitly (which we've kind of rules out against in #33835)
 or we should find a way to more safely assign known related objects in the
 face of deferred fields.
-- 
Ticket URL: <https://code.djangoproject.com/ticket/35442#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 django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018f642933a0-13c0b3ee-7599-44f3-8ee8-6857bfd3bbb7-000000%40eu-central-1.amazonses.com.

Reply via email to