#18435: Caching of reverse ForeignKey lookups
-------------------------------------+-------------------------------------
     Reporter:  selwin               |                    Owner:  nobody
         Type:                       |                   Status:  closed
  Cleanup/optimization               |                  Version:  1.4
    Component:  Database layer       |               Resolution:  invalid
  (models, ORM)                      |             Triage Stage:
     Severity:  Normal               |  Unreviewed
     Keywords:                       |      Needs documentation:  0
    Has patch:  0                    |  Patch needs improvement:  0
  Needs tests:  0                    |                    UI/UX:  0
Easy pickings:  0                    |
-------------------------------------+-------------------------------------

Comment (by selwin):

 Sorry you're right, it's not related to #14270. I just find it odd that
 forward ForeignKey lookups are cached for performance reasons, but not the
 other way round (and both of them are db related operations).

 So this produces one query:

 {{{
 book.author
 book.author
 }}}

 While this produces two queries:

 {{{
 author.book_set.all()
 author.book_set.all()
 }}}

 I know that it probably has always been like this in django, but is this
 something that can be fixed down the road?

-- 
Ticket URL: <https://code.djangoproject.com/ticket/18435#comment:2>
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 django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to