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

Поиск
Список
Период
Сортировка
От Nigel J. Andrews
Тема Re: "select count(*) from contacts" is too slow!
Дата
Msg-id Pine.LNX.4.21.0310071931360.5797-100000@ponder.fairway2k.co.uk
обсуждение исходный текст
Ответ на "select count(*) from contacts" is too slow!  (Paul Serby <paul.serby@clockltd.com>)
Ответы Re: "select count(*) from contacts" is too slow!
Список pgsql-general
On Tue, 7 Oct 2003, 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?

It's a FAQ I believe.

MySQL can tell you from it's index because it doesn't care if it gives you the
right number or not.


--
Nigel Andrews



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

Предыдущее
От: Francois Suter
Дата:
Сообщение: Re: using copy to load odd characters
Следующее
От: Stephan Szabo
Дата:
Сообщение: Re: "select count(*) from contacts" is too slow!