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 <[email protected]> wrote: > On Mon, Oct 24, 2011 at 12:30 PM, Flavia Missi <[email protected]> > 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.djangoproject.com/en/1.3/ref/models/querysets/#django.db.models.query.QuerySet.select_related > > That is all the improvement that I can see in your code, and I agree with > > Tom, but I don't consider using select_related as a premature > optimization, > > I always use it. :) > > That is what I would call the definition of premature optimization! If > you always use it, there will be times when you join to tables/extract > data from the DB that you do not need at that time. > > Cheers > > Tom > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- Flávia Missi @flaviamissi <http://twitter.com/flaviamissi> flaviamissi.com.br https://github.com/flaviamissi -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

