On Sep 9, 8:28 am, Pewpewarrows <marco.cho...@gmail.com> wrote:
> Tim Shaffer's response would have you doing N+1 queries, and having to loop
> through all of your Target objects in-memory. Technically it would work, but
> as soon as you have a decently sized amount of data in there it'd slow to a
> crawl.
>

I just wanted to chime in and point out that select_related() is a
helpful tool for avoiding n+1 queries in django.

   https://docs.djangoproject.com/en/1.3/ref/models/querysets/#select-related

It may not be particularly suitable for this particular problem (due
to the requirement of bringing back only the most recent property on
each target) but I wanted to mention it for the archives since no one
else had.


--Stuart

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to