Received: from localhost (maia-1.hub.org [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id 08A449FB432 for ; Sat, 23 Jun 2007 07:15:18 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-maia, port 10024) with ESMTP id 03780-02 for ; Sat, 23 Jun 2007 07:15:12 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.4 Received: from wx-out-0506.google.com (wx-out-0506.google.com [66.249.82.235]) by postgresql.org (Postfix) with ESMTP id 123CF9FB3E8 for ; Sat, 23 Jun 2007 07:15:12 -0300 (ADT) Received: by wx-out-0506.google.com with SMTP id s16so969646wxc for ; Sat, 23 Jun 2007 03:15:12 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=JbddKYYMWW+gTQgWtSrJvnlYv708bp3nYg2UwlafUfsS0EhsEOPHb9efgHeCZp5ST++iKzSLAUnVD1wTPU7IZS5h72WwO1ysBnKQ1PYFKqYb6clZPa6/ewIibShIT6A0a6Q43mV7GMQx2+e8BbvVwdyHB8y2r3zDu6GkYKyx97I= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=tfZmyKwSr1xac47RrXmIoZvEgwLsDbwSCQhegOWvAbxXKPueav7x4zxBV40lcRxhsGEseYRktwtKsYgMj1M2nlaeUdUh7mpwWSKUUY47DHamo5hKicLJVbE5fkCu2B8laR2f4DPsp0tdG85h27kIm1zlOdoNhribkk+evEzHSCk= Received: by 10.90.63.16 with SMTP id l16mr3290938aga.1182593711862; Sat, 23 Jun 2007 03:15:11 -0700 (PDT) Received: by 10.90.86.20 with HTTP; Sat, 23 Jun 2007 03:15:11 -0700 (PDT) Message-ID: Date: Sat, 23 Jun 2007 12:15:11 +0200 From: "Stefan Arentz" To: pgsql-sql@postgresql.org Subject: Counting all rows MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.001 tagged_above=0 required=5 tests=BAYES_50=0.001 X-Spam-Level: X-Archive-Number: 200706/183 X-Sequence-Number: 28673 I need to get statistics from a bunch of tables. Simply the number of records in them. The query plan looks like this: => explain select count(id) from stuff; QUERY PLAN ------------------------------------------------------------------- Aggregate (cost=1629.69..1629.70 rows=1 width=8) -> Seq Scan on stuff (cost=0.00..1517.75 rows=44775 width=8) The sequential scan kind of worries me. Is there a better/faster way to do this? S. S.