Received: from localhost (maia-4.hub.org [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 7EE239FA294 for ; Thu, 28 Dec 2006 06:48:42 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-new, port 10024) with ESMTP id 10135-02 for ; Thu, 28 Dec 2006 06:48:37 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.171]) by postgresql.org (Postfix) with ESMTP id 6ABBC9FA249 for ; Thu, 28 Dec 2006 06:48:36 -0400 (AST) Received: from [194.25.154.138] (helo=webserv.wug.de) by mrelayeu.kundenserver.de (node=mrelayeu1) with ESMTP (Nemesis), id 0MKwpI-1GzsoM2KUU-0000TF; Thu, 28 Dec 2006 11:48:35 +0100 Received: from kretschmer by webserv.wug.de with local (Exim 3.36 #1) id 1GzsoL-0007kv-00 for pgsql-novice@postgresql.org; Thu, 28 Dec 2006 11:48:33 +0100 Date: Thu, 28 Dec 2006 11:48:33 +0100 From: "A. Kretschmer" To: pgsql-novice@postgresql.org Subject: Re: Performances Message-ID: <20061228104833.GA29704@a-kretschmer.de> References: <4593958B.1040601@carax.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4593958B.1040601@carax.com> X-OS: Debian/GNU Linux - weil ich es mir Wert bin! X-Message-Flag: "Windows" is not the answer. "Windows" is the question and the answer is "no"! User-Agent: Mutt/1.5.9i X-Provags-ID: kundenserver.de abuse@kundenserver.de login:51ea9561fc3f6d9539a2acd743e4748c X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200612/102 X-Sequence-Number: 18196 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