Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id B149B2E0227 for ; Thu, 6 Mar 2008 12:27:16 -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 65373-05 for ; Thu, 6 Mar 2008 12:27:14 -0400 (AST) X-Greylist: delayed 00:13:03.46084 by SQLgrey-1.7.5 Received: from mir3-fs.mir3.com (mail.mir3.com [72.11.241.14]) by postgresql.org (Postfix) with ESMTP id C24DD2E01DC for ; Thu, 6 Mar 2008 12:27:13 -0400 (AST) X-MimeOLE: Produced By Microsoft Exchange V6.0.6619.12 Received: MIR3-FS.mir3.com 172.16.1.11 from 172.16.2.68 172.16.2.68 via HTTP with MS-WebStorage 6.0.6249 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Received: from archimedes by MIR3-FS.mir3.com; 06 Mar 2008 08:14:07 -0800 Organization: MIR3, Inc. X-Mailer: Evolution 2.8.1 In-Reply-To: <47D00DB2.7040007@emolecules.com> content-class: urn:content-classes:message Subject: Re: count * performance issue Date: Thu, 6 Mar 2008 08:16:31 -0800 Message-ID: <1204820047.9048.902.camel@archimedes> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] count * performance issue Thread-Index: Ach/pXDXtJ5YBTKVRRy6ucYyE/RowA== 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> From: "Mark Lewis" To: "Craig James" Cc: X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200803/128 X-Sequence-Number: 29082 On Thu, 2008-03-06 at 07:28 -0800, Craig James wrote: ... > My question is: What do the other databases do that Postgres can't do, = and why not? >=20 > Count() on Oracle and MySQL is almost instantaneous, even for very = large tables. So why can't Postgres do what they do? ... I can vouch that Oracle can still take linear time to perform a count(*), at least in some cases. I have also seen count(*) fast in some cases too... my understanding is that they maintain a list of "interested transactions" on a per-relation basis. Perhaps they do an optimization based on the index size if there are no pending DML transactions? -- Mark