Re: Newbie question: ultra fast count(*)

Поиск
Список
Период
Сортировка
От Jaime Casanova
Тема Re: Newbie question: ultra fast count(*)
Дата
Msg-id c2d9e70e0511251140x5f2a6c2ah6fc81d88fcfb2213@mail.gmail.com
обсуждение исходный текст
Ответ на Newbie question: ultra fast count(*)  (Rodrigo Madera <rodrigo.madera@gmail.com>)
Список pgsql-performance
On 11/25/05, Rodrigo Madera <rodrigo.madera@gmail.com> wrote:
> I have been reading all this technical talk about costs and such that
> I don't (_yet_) understand.
>
> Now I'm scared... what's the fastest way to do an equivalent of
> count(*) on a table to know how many items it has?
>
> Thanks,
> Rodrigo
>

you really *need* this?

you can do
SELECT reltuples FROM pg_class WHERE relname = 'your_table_name';

but this will give you an estimate... if you want real values you can
make a TRIGGER that maintain a counter in another table

--
regards,
Jaime Casanova
(DBA: DataBase Aniquilator ;)

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

Предыдущее
От: Rodrigo Madera
Дата:
Сообщение: Newbie question: ultra fast count(*)
Следующее
От: Jeff Frost
Дата:
Сообщение: Open request for benchmarking input