From: | nconway(at)klamath(dot)dyndns(dot)org (Neil Conway) |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Cc: | Edmund Dengler <edmundd(at)eSentire(dot)com> |
Subject: | Re: Spped of max |
Date: | 2002-05-15 00:28:55 |
Message-ID: | 20020515002855.GA23279@klamath.dyndns.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Tue, May 14, 2002 at 01:27:30PM -0400, Edmund Dengler wrote:
> Greetings all!
>
> Quick question: how long should finding the maximum value in a column
> take?
This is a known issue: max() requires a sequential scan of the
table.
Since PostgreSQL allows user-defined aggregates, this is somewhat
difficult to optimize. No one has yet bothered to create special
cases for max(), min() and perhaps count(), although it could
probably be done.
I'd suggest simply using the workaround you noticed (ORDER BY,
LIMIT 1).
> Now, this type of thing gets me real worried about how good the
> optimizer really is.
The problem doesn't involve the optimizer, AFAICT.
Cheers,
Neil
--
Neil Conway <neilconway(at)rogers(dot)com>
PGP Key ID: DB3C29FC
From | Date | Subject | |
---|---|---|---|
Next Message | Doug Fields | 2002-05-15 01:18:43 | Re: Spped of max |
Previous Message | Laurette Cisneros | 2002-05-14 23:26:42 | pgaccess schema question |