am Thu, dem 28.12.2006, um 10:59:39 +0100 mailte Cedric BUSCHINI folgendes:
> Hello everyone,
>
> A quick question:
> - how long does it take you to perform that query :
> "SELECT COUNT(*) FROM A_TABLE;"
Depends:
test=# \timing
Timing is on.
test=# select count(*) from a_table ;
count
-------
0
(1 row)
Time: 1.700 ms
test=#
>
> There are like 56113000 rows in the table.
A query like above performs a seq. scan on the table - this needs time.
You can get an estimation for this value by asking pg_class.reltuples.
select reltuples from pg_class where relname='a_table';
But this is only a estimation, depends on actual statistics.
It is updated by VACUUM, ANALYZE, and a few DDL commands such as CREATE
INDEX.
Andreas
--
Andreas Kretschmer
Kontakt: Heynitz: 035242/47215, D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID: 0x3FFF606C, privat 0x7F4584DA http://wwwkeys.de.pgp.net