Re: Help w/ optimization

2011-10-24 Thread Flavia Missi
I'm sorry, I think I didn't explain myself right. I always use select_related when I need a join, thus, I avoid more then one query. When I don't need a join I don't use it :) []'s On Mon, Oct 24, 2011 at 9:34 AM, Tom Evans wrote: > On Mon, Oct 24, 2011 at 12:30 PM, Flavia Missi > wrote: > > L

Re: Help w/ optimization

2011-10-24 Thread Tom Evans
On Mon, Oct 24, 2011 at 12:30 PM, Flavia Missi wrote: > Looks like a genre has a genre group associated with it, right? You could > use select_related [1] method when selecting all genres, so, when Django > executes the query, all the relation comes in only one query. > > [1] https://docs.djangopr

Re: Help w/ optimization

2011-10-24 Thread Kurtis Mullins
Thanks guys! I appreciate the great answers! On Mon, Oct 24, 2011 at 7:30 AM, Flavia Missi wrote: > Looks like a genre has a genre group associated with it, right? You could > use select_related [1] method when selecting all genres, so, when Django > executes the query, all the relation comes in

Re: Help w/ optimization

2011-10-24 Thread Flavia Missi
Looks like a genre has a genre group associated with it, right? You could use select_related [1] method when selecting all genres, so, when Django executes the query, all the relation comes in only one query. [1] https://docs.djangoproject.com/en/1.3/ref/models/querysets/#django.db.models.query.Qu

Re: Help w/ optimization

2011-10-24 Thread Tom Evans
On Mon, Oct 24, 2011 at 11:59 AM, Kurtis wrote: > Hey guys, > > I have some custom context in a view. I'm going to be replicating this > context three times for different object relationships. I didn't > count, but looking at django-debug-toolbar I'm thinking this block of > code runs at around 10

Help w/ optimization

2011-10-24 Thread Kurtis
Hey guys, I have some custom context in a view. I'm going to be replicating this context three times for different object relationships. I didn't count, but looking at django-debug-toolbar I'm thinking this block of code runs at around 10 queries. Times that by 3 and I'm going to be bogging my app