Re: what is the maximum number of rows in a table in postgresql 8.1

Поиск
Список
Период
Сортировка
От Ivan Voras
Тема Re: what is the maximum number of rows in a table in postgresql 8.1
Дата
Msg-id fsatvr$poa$1@ger.gmane.org
обсуждение исходный текст
Ответ на Re: what is the maximum number of rows in a table in postgresql 8.1  ("sathiya psql" <sathiya.psql@gmail.com>)
Список pgsql-performance
sathiya psql wrote:
> EXPLAIN ANALYZE SELECT count(*) from call_log_in_ram ;
>                                                             QUERY
> PLAN
> ------------------------------------
> ----------------------------------------------------------------------------------------------
>  Aggregate  (cost=90760.80..90760.80 rows=1 width=0) (actual
> time=6069.373..6069.374 rows=1 loops=1)
>    ->  Seq Scan on call_log_in_ram  (cost=0.00..89121.24 rows=3279119
> width=0) (actual time=0.012..4322.345 rows=3279119 loops=1)
>  Total runtime: 6069.553 ms
> (3 rows)

You will never get good performance automatically with COUNT(*) in
PostgreSQL. You can either create your own infrastructure (triggers,
statistics tables, etc) or use an approximate result like this:

CREATE OR REPLACE FUNCTION fcount(varchar) RETURNS bigint AS $$
        SELECT reltuples::bigint FROM pg_class WHERE relname=$1;
$$ LANGUAGE 'sql';


Use the above function as:

SELECT fcount('table_name');
 fcount
--------
   7412
(1 row)

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

Предыдущее
От: Bill Moran
Дата:
Сообщение: Re: postgresql is slow with larger table even it is in RAM
Следующее
От: "sathiya psql"
Дата:
Сообщение: Re: postgresql is slow with larger table even it is in RAM