X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id DB93CDBC1D for ; Thu, 24 Nov 2005 12:25:49 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 63202-02 for ; Thu, 24 Nov 2005 16:25:47 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id A76AFDBC0C for ; Thu, 24 Nov 2005 12:25:46 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id jAOGPSnR014287; Thu, 24 Nov 2005 11:25:29 -0500 (EST) To: Greg Stark cc: Mark Kirkwood , Luke Lonergan , stange@rentec.com, Dave Cramer , Joshua Marsh , pgsql-performance@postgresql.org Subject: Re: Hardware/OS recommendations for large databases ( In-reply-to: <87d5kqkpd2.fsf@stark.xeocode.com> References: <438583C8.4050809@paradise.net.nz> <87d5kqkpd2.fsf@stark.xeocode.com> Comments: In-reply-to Greg Stark message dated "24 Nov 2005 11:00:25 -0500" Date: Thu, 24 Nov 2005 11:25:28 -0500 Message-ID: <14286.1132849528@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.004 required=5 tests=[AWL=0.004] X-Spam-Score: 0.004 X-Spam-Level: X-Archive-Number: 200511/499 X-Sequence-Number: 15756 Greg Stark writes: > Last I heard the reason count(*) was so expensive was because its state > variable was a bigint. That means it doesn't fit in a Datum and has to be > alloced and stored as a pointer. And because of the Aggregate API that means > it has to be allocated and freed for every tuple processed. There's a hack in 8.1 to avoid the palloc overhead (courtesy of Neil Conway IIRC). regards, tom lane