Re: Limit + group + join

From: "Merlin Moncure" <merlin(dot)moncure(at)rcsonline(dot)com>
To: "Tobias Brox" <tobias(at)nordicbet(dot)com>
Cc: <pgsql-performance(at)postgresql(dot)org>, "Mark Kirkwood" <markir(at)paradise(dot)net(dot)nz>
Subject: Re: Limit + group + join
Date: 2005-08-26 14:49:23
Message-ID: 6EE64EF3AB31D5448D0007DD34EEB3417DD1F1@Herge.rcsinc.local
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Mark Kirkwood
> > The 'desc' seems to be the guy triggering the sort, e.g:
>
> Oh; really an accident that I didn't notice myself, I was actually
going
> to
> remove all instances of "desc" in my simplification, but seems like I
> forgot.

If desc is the problem you can push the query into a subquery without
sorting and sort the result. This is called an inline view. Sometimes
you can pull a couple of tricks to force the view to materialize before
it is sorted.

aka
select q.*
from
(
some_complex_query
) q order by ...;

Merlin

Browse pgsql-performance by date

  From Date Subject
Next Message Merlin Moncure 2005-08-26 15:12:48 Re: difference in plan between 8.0 and 8.1?
Previous Message Alan Stange 2005-08-26 14:45:07 difference in plan between 8.0 and 8.1?