From: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
---|---|
To: | Kris Jurka <books(at)ejurka(dot)com> |
Cc: | Bruce Momjian <momjian(at)svr1(dot)postgresql(dot)org>, pgsql-committers(at)postgresql(dot)org |
Subject: | Re: pgsql: Remove item, not sure what it refers to: |
Date: | 2005-04-25 13:05:47 |
Message-ID: | 200504251305.j3PD5lm28145@candle.pha.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
Kris Jurka wrote:
>
>
> On Sat, 23 Apr 2005, Bruce Momjian wrote:
>
> > Log Message:
> > -----------
> > Remove item, not sure what it refers to:
> >
> > < * Allow ORDER BY ... LIMIT 1 to select high/low value without sort or
> > < index using a sequential scan for highest/lowest values
> > <
> > < If only one value is needed, there is no need to sort the entire
> > < table. Instead a sequential scan could get the matching value.
> > <
>
> This is actually a suggestion from Oleg here:
>
> http://archives.postgresql.org/pgsql-general/2002-04/msg00464.php
>
> double min = DBL_MAX;
> for (i=0; i<N; i++) {
> if (data[i] < min) {
> min = data[i];
> }
> }
OK, so you are saying that right now if we want ORDER BY ... LIMIT 1,
and there is no index, we sort the result then pick the high value,
rather than just doing a sequential scan and grabbing the high/low
value. Makes sense now.
Thanks, TODO item readded with a clearer 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.
--
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
From | Date | Subject | |
---|---|---|---|
Next Message | Stephen Frost | 2005-04-25 13:52:02 | Re: pgsql: Remove item, not sure what it refers to: |
Previous Message | Bruce Momjian | 2005-04-25 13:03:37 | pgsql: Re-add item with better description: > * Allow ORDER BY ... |