Re: COUNT(*) and index-only scans

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: COUNT(*) and index-only scans
Дата
Msg-id 5617.1318272187@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: COUNT(*) and index-only scans  ("Kevin Grittner" <Kevin.Grittner@wicourts.gov>)
Ответы Re: COUNT(*) and index-only scans
Список pgsql-hackers
"Kevin Grittner" <Kevin.Grittner@wicourts.gov> writes:
> Bruce Momjian <bruce@momjian.us> wrote:
>> I talked to Robert Haas and he said that index-only scans do not
>> optimize COUNT(*).  Is this something we can do for PG 9.2?  Is
>> anyone working on this?
> Well, it's not that it doesn't optimize COUNT(*) -- it's that it
> doesn't yet cost the index scan as cheaper than a table scan when
> you're accessing every row.

I think what Robert is complaining about is that we won't currently
consider an index that matches neither any WHERE clauses nor ORDER BY,
ie, count(*) over the whole table won't get considered for an index-only
scan, regardless of cost estimates.
        regards, tom lane


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: SET variable - Permission issues
Следующее
От: Tom Lane
Дата:
Сообщение: Re: ALTER EXTENSION .. ADD/DROP weirdness