On Thu, Oct 23, 2008 at 11:21 AM, AndyB <[EMAIL PROTECTED]> wrote:

>
> Apologies for not using DPaste. I thought the snippets were small
> enough. And I thought my question was cleared than it turned out to
> be!
>

I wasn't saying what you posted would have been better at dpaste.com, what
you posted was fine.  I was saying your model definitions might work better
at dpaste.com than inline.


> To clarify (where someobject_set is a related-object queryset):
>
> someobject_set.all().query.as_sql()
> someobject_set.select_related().query.as_sql()
>
> Both show identical SQL is being generated - which indicates that
> select_related() isn't following any relationships.
>

What select_related does, exactly, is dependent on the model definitions.
It doesn't follow relations which can be null, for example.  Which is why I
asked for your model definitions.  You're also applying the select_related
to a related set, which may be coming into play (this is not code I'm
terribly familiar with), but when I try analogs to your queries on my own
models, I do get different sql reflecting select_related is having an
effect.  Which is why I asked for your model definitions.  Without seeing
your models I haven't the vaguest idea how what you are doing with your
models is different from what I am doing.

Karen

--~--~---------~--~----~------------~-------~--~----~
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