Re: Spped of max

Поиск
Список
Период
Сортировка
От nconway@klamath.dyndns.org (Neil Conway)
Тема Re: Spped of max
Дата
Msg-id 20020515002855.GA23279@klamath.dyndns.org
обсуждение исходный текст
Ответ на Spped of max  (Edmund Dengler <edmundd@eSentire.com>)
Ответы Re: Spped of max  (Doug Fields <dfields-pg-general@pexicom.com>)
Список 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@rogers.com>
PGP Key ID: DB3C29FC

В списке pgsql-general по дате отправления:

Предыдущее
От: "Corey W. Gibbs"
Дата:
Сообщение: Re: Using COPY
Следующее
От: Doug Fields
Дата:
Сообщение: Re: Spped of max