count(*) optimization

Поиск
Список
Период
Сортировка
От huaxin zhang
Тема count(*) optimization
Дата
Msg-id f2f5625105090612215aafe162@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Simple tester for MVCC in PostgreSQL  (Matt Miller <mattm@epx.com>)
Ответы Re: count(*) optimization  ("Jonah H. Harris" <jonah.harris@gmail.com>)
Re: count(*) optimization  (Bruno Wolff III <bruno@wolff.to>)
Список pgsql-hackers
not sure where to put this.

I run two queries:

1. select count(*) from table where indexed_column<10;
2. select * from table where indexed_column<10;

the indexed column is not clustered at all. I saw from the trace that
both query runs
through index scans on that index and takes the same amount of buffer
hits and disk read. However, shouldn't the optimizer notice that the
first query only needs to look at the indexes
and possibly reduce the amount of buffer/disk visits?

thanks


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

Предыдущее
От: "Jim C. Nasby"
Дата:
Сообщение: Re: Call for 7.5 feature completion
Следующее
От: "Jonah H. Harris"
Дата:
Сообщение: Re: count(*) optimization