X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 335A89DC881 for ; Sun, 19 Mar 2006 00:55:33 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 67502-05 for ; Sun, 19 Mar 2006 00:55:31 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from wolff.to (wolff.to [66.93.197.194]) by postgresql.org (Postfix) with SMTP id CCFC59DC811 for ; Sun, 19 Mar 2006 00:55:28 -0400 (AST) Received: (qmail 15036 invoked by uid 500); 19 Mar 2006 04:56:52 -0000 Date: Sat, 18 Mar 2006 22:56:52 -0600 From: Bruno Wolff III To: Stefan Meyer Cc: pgsql-sql@postgresql.org Subject: Re: rowcount for all tables Message-ID: <20060319045652.GA14031@wolff.to> Mail-Followup-To: Bruno Wolff III , Stefan Meyer , pgsql-sql@postgresql.org References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.1i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.102 required=5 tests=[AWL=0.102] X-Spam-Score: 0.102 X-Spam-Level: X-Archive-Number: 200603/273 X-Sequence-Number: 24619 On Fri, Mar 17, 2006 at 14:39:04 +0100, Stefan Meyer wrote: > i have a beginner question and i have read the FAQs. > is there a faster ways than > > select count(*) from foo; > > to get the rowcount for the tables in my db ? There are some ways to get approximate counts that won't require scanning the whole table. If you are going to be doing lots of these, you can use triggers to maintain a count. There is also a more complicated approach that can be used to reduce contention. You should be able to find more details in the archives.