Re: pgsql: Remove item, not sure what it refers to: - Mailing list pgsql-committers

From Bruce Momjian
Subject Re: pgsql: Remove item, not sure what it refers to:
Date
Msg-id 200504251305.j3PD5lm28145@candle.pha.pa.us
Whole thread Raw
In response to Re: pgsql: Remove item, not sure what it refers to:  (Kris Jurka <books@ejurka.com>)
Responses Re: pgsql: Remove item, not sure what it refers to:  (Stephen Frost <sfrost@snowman.net>)
List 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@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

pgsql-committers by date:

Previous
From: momjian@svr1.postgresql.org (Bruce Momjian)
Date:
Subject: pgsql: Re-add item with better description: > * Allow ORDER BY ...
Next
From: Stephen Frost
Date:
Subject: Re: pgsql: Remove item, not sure what it refers to: