Re: Slow sub-selects, max and count(*)

Поиск
Список
Период
Сортировка
От Greg Stark
Тема Re: Slow sub-selects, max and count(*)
Дата
Msg-id 87brmhtrcs.fsf@stark.xeocode.com
обсуждение исходный текст
Ответ на Re: Slow sub-selects, max and count(*)  (Josh Berkus <josh@agliodbs.com>)
Ответы Re: Slow sub-selects, max and count(*)  (Josh Berkus <josh@agliodbs.com>)
Список pgsql-sql
Josh Berkus <josh@agliodbs.com> writes:

> Max() and Count() cannot use indexes for technical reasons.   Browse through 
> the archives of SQL, PERFORM, and HACKERS for about 12,000 discussions on the 
> subject.

Please don't confuse the issue by throwing Max() and Count() into the same
basket.

The issue with Min()/Max() is that the result could be generated efficiently
by scanning indexes but it's just hard, especially given generic aggregate
functions, and the work simply hasn't been done, or even started, yet.

The issue with Count() is that people want the result to be cached in a single
per-table counter, but that can't be done as simply as that because of
transactions. People have discussed complex solutions to this but it's a much
more complex problem than it appears.

They're really two entirely separate issues.

-- 
greg



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

Предыдущее
От: Markus Bertheau
Дата:
Сообщение: Re: Invalid Unicode Character Sequence found
Следующее
От: "Tsoloane Moahloli"
Дата:
Сообщение: Re: date_part stored procs