Re: Why count(*) doest use index?

Поиск
Список
Период
Сортировка
От Alban Hertroys
Тема Re: Why count(*) doest use index?
Дата
Msg-id 1B34B94E-1A19-400C-9BCE-627227420760@solfertje.student.utwente.nl
обсуждение исходный текст
Ответ на Re: Why count(*) doest use index?  (Allan Kamau <kamauallan@gmail.com>)
Список pgsql-general
On 6 Mar 2011, at 9:03, Allan Kamau wrote:

> If this is true it seems that the primary key and perhaps other unique
> indexes do indeed contain exact details of the uniqueness of the
> persisted tuples of a given relation at any given time.

That is true within a single transaction, but indexes contain information about ALL active transactions. Because of
thatthe contents of the indexes are not guaranteed to be unique and it's possible they contain references to rows that
arenot visible to the current transaction. 

> Or am I missing a crucial point.


Yup, you're missing the effects of concurrency.

Alban Hertroys

--
If you can't see the forest for the trees,
cut the trees and you'll see there is no forest.


!DSPAM:737,4d7365c5235885600661482!



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

Предыдущее
От: Martijn van Oosterhout
Дата:
Сообщение: Re: Why count(*) doest use index?
Следующее
От: Alexander Farber
Дата:
Сообщение: Copying few tables from one database to another