Re: pgsql: Re-add item with better description: > * Allow

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-committers(at)postgresql(dot)org
Subject: Re: pgsql: Re-add item with better description: > * Allow
Date: 2005-04-25 15:35:16
Message-ID: 200504251535.j3PFZH606995@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Tom Lane wrote:
> momjian(at)svr1(dot)postgresql(dot)org (Bruce Momjian) writes:
> > Re-add item with better description:
>
> >> * Allow ORDER BY ... LIMIT 1 to select high/low value without sort or
> >> index using a sequential scan for highest/lowest values
> >>
> >> Right now, if no index exists, ORDER BY ... LIMIT 1 requires we sort
> >> all values to return the high/low value. Instead The idea is to do a
> >> sequential scan to find the high/low value, thus avoiding the sort.
>
> That's not much better, as it simply begs the question "why not use
> MIN/MAX"?

> I think the real point of Oleg's suggestion is a better way to do "top N"
> queries. This does not get interesting unless N > 1.

Good point, updated:

* Allow ORDER BY ... LIMIT # to select high/low value without sort or
index using a sequential scan for highest/lowest values

Right now, if no index exists, ORDER BY ... LIMIT # requires we sort
all values to return the high/low value. Instead The idea is to do a
sequential scan to find the high/low value, thus avoiding the sort.
MIN/MAX already does this, but not for LIMIT > 1.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Browse pgsql-committers by date

  From Date Subject
Next Message Bruce Momjian 2005-04-25 15:35:32 pgsql: Update description: < * Allow ORDER BY ...
Previous Message Tom Lane 2005-04-25 15:29:12 Re: pgsql: Re-add item with better description: > * Allow ORDER BY ...