pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: A. Kretschmer <andreas.kretschmer@schollglas.com>
To: pgsql-novice@postgresql.org
Subject: Re: Performances
Date: Thu, 28 Dec 2006 11:48:33 +0100
Message-ID: <20061228104833.GA29704@a-kretschmer.de> (raw)
In-Reply-To: <4593958B.1040601@carax.com>
References: <4593958B.1040601@carax.com>

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



view thread (4+ messages)  latest in thread

Message-ID: <20061228104833.GA29704@a-kretschmer.de>
Permalink:  ../20061228104833.GA29704@a-kretschmer.de/
Also on:    postgresql.org/message-id/20061228104833.GA29704@a-kretschmer.de

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: andreas.kretschmer@schollglas.com, pgsql-novice@postgresql.org
  Subject: Re: Performances
  In-Reply-To: <20061228104833.GA29704@a-kretschmer.de>
  References: <4593958B.1040601@carax.com> <20061228104833.GA29704@a-kretschmer.de>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox