Re: Seqscan in MAX(index_column)

From: "scott(dot)marlowe" <scott(dot)marlowe(at)ihs(dot)com>
To: Greg Stark <gsstark(at)mit(dot)edu>
Cc: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Seqscan in MAX(index_column)
Date: 2003-09-05 15:56:15
Message-ID: Pine.LNX.4.33.0309050954340.30557-100000@css120.ihs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Czuczy Gergely 2003-09-05 15:57:20 Logging improvements and rehashing
Previous Message Tom Lane 2003-09-05 15:45:30 Re: 64-bit pgsql