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 8A82FDA57A for ; Fri, 7 Oct 2005 11:15:23 -0300 (ADT) 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 52220-03 for ; Fri, 7 Oct 2005 14:15:16 +0000 (GMT) Received: from mail.metronet.co.uk (mail.metronet.co.uk [213.162.97.75]) by svr1.postgresql.org (Postfix) with ESMTP id C91E8DA571 for ; Fri, 7 Oct 2005 11:15:18 -0300 (ADT) Received: from mainbox.archonet.com (84-51-143-99.archon037.adsl.metronet.co.uk [84.51.143.99]) by smtp.metronet.co.uk (MetroNet Mail) with ESMTP id DC0CD416F35; Fri, 7 Oct 2005 15:15:10 +0100 (BST) Received: from localhost (localhost.localdomain [127.0.0.1]) by mainbox.archonet.com (Postfix) with ESMTP id 596A615EDA; Fri, 7 Oct 2005 15:11:20 +0100 (BST) Received: from mainbox.archonet.com ([127.0.0.1]) by localhost (mainbox [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 19964-05; Fri, 7 Oct 2005 15:11:07 +0100 (BST) Received: from [192.168.1.17] (client17.office.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id 2D94915ED5; Fri, 7 Oct 2005 15:11:02 +0100 (BST) Message-ID: <434681F5.6000906@archonet.com> Date: Fri, 07 Oct 2005 15:11:01 +0100 From: Richard Huxton User-Agent: Mozilla Thunderbird 1.0.6 (X11/20050912) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Tom Lane Cc: pgsql-performance@postgresql.org Subject: Re: count(*) using index scan in "query often, update rarely" References: <935801c5cb20$dcf93a00$131fc39e@stratos> <3254.1128692552@sss.pgh.pa.us> In-Reply-To: <3254.1128692552@sss.pgh.pa.us> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.058 required=5 tests=[AWL=0.008, FORGED_RCVD_HELO=0.05] X-Spam-Level: X-Archive-Number: 200510/144 X-Sequence-Number: 14912 Tom Lane wrote: > > There's a workable-looking design in the archives (pghackers probably) > for maintaining overall table counts in a separate table, with each > transaction adding one row of "delta" information just before it > commits. I haven't seen anything else that looks remotely attractive. It might be useful if there was a way to trap certain queries and rewrite/replace them. That way more complex queries could be transparently redirected to a summary table etc. I'm guessing that the overhead to check every query would quickly destroy any gains though. -- Richard Huxton Archonet Ltd