#31666: Combine prefetch_related queries for FK's to the same target model
-------------------------------------+-------------------------------------
     Reporter:  Adam (Chainz)        |                    Owner:  nobody
  Johnson                            |
         Type:                       |                   Status:  new
  Cleanup/optimization               |
    Component:  Database layer       |                  Version:  master
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     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 Gordon Wrigley):

 To my mind the duplicate objects in memory is kinda a feature.
 Specifically it seems desirable to me that a prefetch related clause only
 changes performance not behaviour. Particularly it seems concerning that
 adding a prefetch_related to this (very contrived) example would change
 it's behaviour:

 {{{
 b = Book.objects.get()
 b.author1.weight = 90
 b.author2.weight = 50
 print(b.author1.weight + b.author2.weight)
 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/31666#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 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/068.b3c0dd41e58d9335b7433d8ca1e0f4b9%40djangoproject.com.

Reply via email to