Re: reverse caching of foreign keys #3369

2007-02-09 Thread [EMAIL PROTECTED]
In response to: > b = Blog.objects.get(id=1) > [ I do some other things here, and meanwhile the title of blog with > id=1 was changed] > for entry in b.entry_set.all(): > entry.blog is b # Is this still true? > entry.blog.title is b.title # How about this? I understand how this could hap

Re: reverse caching of foreign keys #3369

2007-02-08 Thread Brian Harring
On Fri, Feb 09, 2007 at 04:35:37AM -, Gary Wilson wrote: > > On Jan 29, 4:25 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > > b = Blog.objects.get(id=1) > > for entry in b.entry_set.all(): > > entry.blog is b # True > > So what if the blog with id=1 changes in between ac

Re: reverse caching of foreign keys #3369

2007-02-08 Thread Gary Wilson
On Feb 8, 11:10 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Does anyone else have any thoughts on this? Oh, and I forgot to mention that there is a similar ticket wanting the same thing for select_related: Ticket #17 - Metasystem optimization: Share select_related in memory http://code.d

Re: reverse caching of foreign keys #3369

2007-02-08 Thread Gary Wilson
On Jan 29, 4:25 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > b = Blog.objects.get(id=1) > for entry in b.entry_set.all(): > entry.blog is b # True So what if the blog with id=1 changes in between accesses? What if I had b = Blog.objects.get(id=1) [ I do some other things

Re: reverse caching of foreign keys #3369

2007-02-08 Thread [EMAIL PROTECTED]
Does anyone else have any thoughts on this? On Jan 29, 4:25 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > It's a lot more efficient, for one. > > select_related() generates more code to query the database. It also > goes as "far as possible", so if the blog has a lot more relationships >

Re: reverse caching of foreign keys #3369

2007-01-29 Thread [EMAIL PROTECTED]
It's a lot more efficient, for one. select_related() generates more code to query the database. It also goes as "far as possible", so if the blog has a lot more relationships to it or if the entries have a lot more relationships to them, then select_related would be pretty inefficient especia

Re: reverse caching of foreign keys #3369

2007-01-29 Thread Jacob Kaplan-Moss
On 1/28/07 8:42 PM, [EMAIL PROTECTED] wrote: > i just wanted to spark some discussion of #3369. i implemented it and > would like to see it get included. > > here's an example of what reverse caching of foreign keys would mean: > > b = Blog.objects.get(id=1) > for entry in b.entry_set.

reverse caching of foreign keys #3369

2007-01-29 Thread [EMAIL PROTECTED]
i just wanted to spark some discussion of #3369. i implemented it and would like to see it get included. here's an example of what reverse caching of foreign keys would mean: b = Blog.objects.get(id=1) for entry in b.entry_set.all(): entry.blog # No database access required. c