Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id DB69B2E007F for ; Thu, 6 Mar 2008 22:56:50 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 79763-04 for ; Thu, 6 Mar 2008 22:56:48 -0400 (AST) X-Greylist: delayed 00:15:27.561812 by SQLgrey-1.7.5 Received: from smtp3.clear.net.nz (smtp3.clear.net.nz [203.97.33.64]) by postgresql.org (Postfix) with ESMTP id 645862E0048 for ; Thu, 6 Mar 2008 22:56:48 -0400 (AST) Received: from zmori.markir.net (121-73-161-198.dsl.telstraclear.net [121.73.161.198]) by smtp3.clear.net.nz (CLEAR Net Mail) with ESMTP id <0JXC00E0MA4F5Q40@smtp3.clear.net.nz> for pgsql-performance@postgresql.org; Fri, 07 Mar 2008 15:41:05 +1300 (NZDT) Date: Fri, 07 Mar 2008 15:40:45 +1300 From: Mark Kirkwood Subject: Re: count * performance issue In-reply-to: <47D00DB2.7040007@emolecules.com> To: Craig James Cc: pgsql-performance@postgresql.org Message-id: <47D0AB2D.6080802@paradise.net.nz> MIME-version: 1.0 Content-type: text/plain; charset=ISO-8859-1; format=flowed Content-transfer-encoding: 7bit References: <20080306060829.GA21084@a-kretschmer.de> <47CF8EA6.8070503@mark.mielke.cc> <20080306063643.GB21084@a-kretschmer.de> <3E9C3A51-C28E-4B75-9739-E344DAC72880@fastcrypt.com> <47D00DB2.7040007@emolecules.com> User-Agent: Thunderbird 2.0.0.9 (X11/20071203) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200803/141 X-Sequence-Number: 29095 Craig James wrote: > > My question is: What do the other databases do that Postgres can't do, > and why not? > > Count() on Oracle and MySQL is almost instantaneous, even for very > large tables. So why can't Postgres do what they do? > I think Mysql can only do that for the myisam engine - innodb and falcon are similar to Postgres. I don't believe Oracle optimizes bare count(*) on a table either - tho it may be able to use a suitable index (if present) to get the answer quicker. regards Mark