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

From: Magnus Hagander <magnus(at)hagander(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-committers(at)postgresql(dot)org
Subject: Re: pgsql: Teach tuplesort.c about "top N" sorting, in which only the first
Date: 2007-05-04 16:26:38
Message-ID: 20070504162638.GD30617@svr2.hagander.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

On Fri, May 04, 2007 at 10:04:08AM -0400, Tom Lane wrote:
> Magnus Hagander <magnus(at)hagander(dot)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

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2007-05-04 16:38:18 Re: pgsql: Teach tuplesort.c about "top N" sorting, in which only the first
Previous Message User Dpage 2007-05-04 16:17:56 pginstaller - pginst: Updated Russian translation from Andrey Repko

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2007-05-04 16:34:01 Re: Grantor name gets lost when grantor role dropped
Previous Message Tom Lane 2007-05-04 16:24:39 Re: Grantor name gets lost when grantor role dropped