Re: [PHP3] [OT]: SELECT COUNT(*) in Postgres

Поиск
Список
Период
Сортировка
От Clark Evans
Тема Re: [PHP3] [OT]: SELECT COUNT(*) in Postgres
Дата
Msg-id 3702BC1F.C33BB699@manhattanproject.com
обсуждение исходный текст
Список pgsql-hackers
It seems that one topic of discussion regarding the optimizer
is that it dosen't know how many rows are in the table untill
an analyze is done.  Doing SELECT COUNT(*) seems like something
often done that also requires the number of rows in the table
to be known.  Perhaps it would be prudent to keep a running
total of the number of active rows for each table cashed?

Clark

Jordan Krushen wrote:
> I know that MySQL doesn't actually hit the tables when doing a SELECT
> COUNT(*), and it returns very quickly as a result.. On large Postgres
> tables, COUNT(*) is horrendously slow.  What I'm wondering is if anybody
> here knows a faster way to get the row count, be it an internal Postgres
> variable one can access, or if a COUNT(small_primary_key) would be faster.
> Any ideas?
>


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: [HACKERS] libpq++
Следующее
От: Vince Vielhaber
Дата:
Сообщение: Re: [HACKERS] libpq++