Re: pgsql: Teach tuplesort.c about "top N" sorting, in which only the first - Mailing list pgsql-committers

From Magnus Hagander
Subject Re: pgsql: Teach tuplesort.c about "top N" sorting, in which only the first
Date
Msg-id 20070504162638.GD30617@svr2.hagander.net
Whole thread Raw
In response to Re: pgsql: Teach tuplesort.c about "top N" sorting, in which only the first  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: pgsql: Teach tuplesort.c about "top N" sorting, in which only the first  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-committers
On Fri, May 04, 2007 at 10:04:08AM -0400, Tom Lane wrote:
> Magnus Hagander <magnus@hagander.net> writes:
> > Is there some way to see in the generated query plan if this optimisation
> > is used?
>
> If there's a SORT just below a LIMIT (that has a limit, ie it's not just
> an OFFSET), then it's potentially used.  Whether it's actually used
> depends on actual row counts and widths at runtime --- you'd have to
> turn on trace_sort and look at the log output to determine that.

Could we show it in EXPLAIN ANALYZE somehow? I'm thinking it would be good
to see at runtime (for example as a hint that if you put in a bit more
work_mem it might get used)

//Magnus


pgsql-committers by date:

Previous
From: dpage@pgfoundry.org (User Dpage)
Date:
Subject: pginstaller - pginst: Updated Russian translation from Andrey Repko
Next
From: Tom Lane
Date:
Subject: Re: pgsql: Teach tuplesort.c about "top N" sorting, in which only the first