Re: Why is it not using an index?

Поиск
Список
Период
Сортировка
От Stephan Szabo
Тема Re: Why is it not using an index?
Дата
Msg-id 20020315120934.Y54258-100000@megazone23.bigpanda.com
обсуждение исходный текст
Ответ на Re: Why is it not using an index?  (Dmitry Tkach <dmitry@openratings.com>)
Список pgsql-general
On Fri, 15 Mar 2002, Dmitry Tkach wrote:

> explain select count (x) from a ;
>
> Aggregate� (cost=100175934.05..100175934.05 rows=1 width=2)
> � ->� Seq Scan on a� (cost=100000000.00..100150659.04 rows=10110004 width=2)
>
> Am I missing something here again, or will it just not use an index
> for aggregation?

It won't for something like the above because it needs to test each row
to see if it's currently visible to your transaction (which involves
reading from the table file anyway) which means you end up reading the
entire table plus the index (and paying some costs in random access).
If the index had the transaction information the index would be usable
but there are issues about doing that as well (you might want to check
past messages - especially ones from Tom Lane - on the subject)



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

Предыдущее
От: "Gregory Wood"
Дата:
Сообщение: Re: Why is it not using an index?
Следующее
От: Fernando Schapachnik
Дата:
Сообщение: Re: Database quota