Re: Strange logic for partial index proving

Поиск
Список
Период
Сортировка
От Bruno Wolff III
Тема Re: Strange logic for partial index proving
Дата
Msg-id 20050623155453.GA14442@wolff.to
обсуждение исходный текст
Ответ на Re: Strange logic for partial index proving  (laser <laser@toping.com.cn>)
Список pgsql-hackers
On Thu, Jun 23, 2005 at 16:13:24 +0800, laser <laser@toping.com.cn> wrote:
> 
> This thread make me to think about the question:
> could this "feature" be used in select count(*) type
> query that force it to use index?

count(*) can already be helped by indexes, but probably not the way you think.
The count isn't saved anywhere, so each row needs to be checked to make sure
it is visible to the current transaction and that it satisfies any WHERE
conditions. The latter can sometimes be sped up using index scans (typically
if the matchin grows are less than 5% of the table or somewhat more if
the rows are clustered according to the index). If you are counting all
of the visible records in a table a sequential scan is going to be
the fastest plan.


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

Предыдущее
От: Alvaro Herrera
Дата:
Сообщение: Re: regression failure
Следующее
От: Jan Wieck
Дата:
Сообщение: Re: [GENERAL] plpgsql constraint checked data fails to restore