Re: "select count(*) from contacts" is too slow!

Поиск
Список
Период
Сортировка
От Christopher Browne
Тема Re: "select count(*) from contacts" is too slow!
Дата
Msg-id m3isn0aol7.fsf@wolfe.cbbrowne.com
обсуждение исходный текст
Ответ на "select count(*) from contacts" is too slow!  (Paul Serby <paul.serby@clockltd.com>)
Список pgsql-general
A long time ago, in a galaxy far, far away, paul.serby@clockltd.com (Paul Serby) wrote:
> Why does 'select count(id) from "tblContacts"' do a sequential scan
> when the field 'id' is indexed using a btree?  MySql simply looks at
> the index which is keeping a handy record of the number of rows.
> Can anybody explain how and why postgres does this query like it
> does?

Look into the semantics of MVCC (MultiVersion Concurrency Control);
that (otherwise useful) feature prevents having any such "handy
record."
--
let name="cbbrowne" and tld="cbbrowne.com" in String.concat "@" [name;tld];;
http://www.ntlug.org/~cbbrowne/spreadsheets.html
Developmental Psychology
"Schoolyard behavior resembles adult primate behavior because "Ontogeny
Recapitulates Phylogeny" doesn't stop at birth."
-- Mark Miller

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

Предыдущее
От: "John Wells"
Дата:
Сообщение: Humor me: Postgresql vs. MySql (esp. licensing)
Следующее
От: Christopher Browne
Дата:
Сообщение: Re: "select count(*) from contacts" is too slow!