Re: Seqscan in MAX(index_column) - Mailing list pgsql-hackers

From scott.marlowe
Subject Re: Seqscan in MAX(index_column)
Date
Msg-id Pine.LNX.4.33.0309050954340.30557-100000@css120.ihs.com
Whole thread Raw
In response to Re: Seqscan in MAX(index_column)  (Greg Stark <gsstark@mit.edu>)
Responses Re: Seqscan in MAX(index_column)
List pgsql-hackers
Would it be possible to catch an unconstrained max(id)/min(id) and rewrite 
it as "select id from table order by id [desc] limit1" on the fly in the 
parser somewhere?

That would require fairly little code, and be transparent to the user.  
I.e. low hanging fruit.

On 5 Sep 2003, Greg Stark wrote:

> Note that that only handles min()/max() for the whole table. It doesn't handle
> the GROUP BY case, for that you need DISTINCT ON with an ORDER BY clause.



pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: [PATCHES] Warning for missing createlang
Next
From: Greg Stark
Date:
Subject: Re: Seqscan in MAX(index_column)