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 9F77DD9AB9 for ; Fri, 7 Oct 2005 07:48: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 96807-09 for ; Fri, 7 Oct 2005 10:48:17 +0000 (GMT) Received: from cassarossa.samfundet.no (cassarossa.samfundet.no [129.241.93.19]) by svr1.postgresql.org (Postfix) with ESMTP id A7594D9001 for ; Fri, 7 Oct 2005 07:48:17 -0300 (ADT) Received: from trofast.sesse.net ([129.241.93.32]) by cassarossa.samfundet.no with esmtp (Exim 4.50) id 1ENply-0004nP-CK for pgsql-performance@postgresql.org; Fri, 07 Oct 2005 12:48:19 +0200 Received: from sesse by trofast.sesse.net with local (Exim 3.36 #1 (Debian)) id 1ENplw-0002QF-00 for ; Fri, 07 Oct 2005 12:48:16 +0200 Date: Fri, 7 Oct 2005 12:48:16 +0200 From: "Steinar H. Gunderson" To: pgsql-performance@postgresql.org Subject: Re: count(*) using index scan in "query often, update rarely" environment Message-ID: <20051007104816.GA8371@uio.no> Mail-Followup-To: pgsql-performance@postgresql.org References: <935801c5cb20$dcf93a00$131fc39e@stratos> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <935801c5cb20$dcf93a00$131fc39e@stratos> X-Operating-System: Linux 2.6.11.8 on a i686 X-Message-Flag: Outlook? --> http://www.mozilla.org/products/thunderbird/ User-Agent: Mutt/1.5.10i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.012 required=5 tests=[AWL=0.012] X-Spam-Level: X-Archive-Number: 200510/137 X-Sequence-Number: 14905 On Fri, Oct 07, 2005 at 11:24:05AM +0200, Cestmir Hybl wrote: > Isn't it possible (and reasonable) for these environments to keep track of > whether there is a transaction in progress with update to given table and > if not, use an index scan (count(*) where) or cached value (count(*)) to > perform this kind of query? Even if there is no running update, there might still be dead rows in the table. In any case, of course, a new update could always be occurring while your counting query was still running. /* Steinar */ -- Homepage: http://www.sesse.net/