On 2/27/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> Could somebody explain the difference between
lets assume you have models
Article
Author
Category

where every article has one author and one category
>
> Foo.objects.all() and
this will do something like

select * from articles;

> Foo.objects.select_related()
this will do something like:

select articles.*, author.*, category.* from articles join author on
article.author_id = author.id join category on article.category_id =
category.id;

so you will have more data coming out of the DB and a more complicated
query, but it will be one select and article.author won't result in a
DB hit

>
> I'm trying to improve performance and decrease DB hits.
>
>
> >
>


-- 
Honza Kr�l
E-Mail: [EMAIL PROTECTED]
ICQ#:   107471613
Phone:  +420 606 678585

--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to