On Thu, Jul 14, 2011 at 2:17 PM, bruno desthuilliers <
bruno.desthuilli...@gmail.com> wrote:

> On 14 juil, 02:24, "Cal Leeming [Simplicity Media Ltd]"
> <cal.leem...@simplicitymedialtd.co.uk> wrote:
> > On 14 Jul 2011 00:13, "bruno desthuilliers" <
> bruno.desthuilli...@gmail.com>
> > wrote:
> >> And FWIW, did you try the obvious:
> >
> >> return Session.objects.filter(
> >>            member__username=self.username,
> >>            is_fake = 0
> >>         ).order_by("-id")
> >
> > If you look at the original query i pasted, you'll see that this
> > modification wouldn't have been any better (as they both would have
> > generated the same query).
>
> Your original code used a subquery, this one should use a couple inner
> join, ie something like :
>
> select * from session s inner join member m on s.member_id = m.id
> inner join user u on m.user_id = u.id where u.username='%s' and
> s.is_fake=0 order by s.id desc;
>

Oh right, I didn't realise. Tell you what, I'll try it out later and let you
know :) Thanks for the heads up on this!


>
> (sorry, don't have any django project at hand ATM so I can't check the
> exact SQL Django would generate here).
>
>
> Now that still doesn't mean you'd get better performances... :-/
>
> --
> 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
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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