Re: Performances

From: "A(dot) Kretschmer" <andreas(dot)kretschmer(at)schollglas(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: Performances
Date: 2006-12-28 10:48:33
Message-ID: 20061228104833.GA29704@a-kretschmer.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin pgsql-novice

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

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Bricklen Anderson 2006-12-28 17:17:51 Re: Performances
Previous Message Cedric BUSCHINI 2006-12-28 09:59:39 Performances

Browse pgsql-novice by date

  From Date Subject
Next Message Bricklen Anderson 2006-12-28 17:17:51 Re: Performances
Previous Message Cedric BUSCHINI 2006-12-28 09:59:39 Performances