ok, thank for reply.

I think that with this query:

" AA.object.filter(...).select_related( field related in BB ) "

The impact in the performance is minimun

But with this query

" AA.object.filter(...).select_related() "

the impact is higher, because the first query do an unique "join", but
the second "join" can do multiple "join"s and I just need the AA
fields and the BB fields.

Is this idea correct?

On 15 oct, 12:27, Daniel Roseman <dan...@roseman.org.uk> wrote:
> On Oct 15, 4:19 pm, refreegrata <refreegr...@yahoo.com> wrote:
>
>
>
> > Hello, how can i get fields from different tables related for a
> > foreign key?
>
> > When I do a inner join like
>
> > AA.objects.filter(bb__field = ...) ...
>
> > I just can access to the AA fields, and not to fields in the other
> > table
>
> > in a normal query i can do something like "select AA.*, BB.* FROM. AA
> > inner join BB..."
> > but in django the resultant query is "select AA.* FROM. AA inner join
> > BB..."
>
> > Now i use select_related for solve this problem isn't recommended ,
> > because this query has an impact in the server performance. How i can
> > solve this?
>
> > Thanks for read, and sorry for my poor english.
>
> select_related *is* the answer to this question. Of cours all joins
> have an impact on server performance, because you're asking the
> database to do more work, but this is likely to be very very small,
> and there isn't a way of doing what you want without some form of
> join.
> --
> DR.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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