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 24D6FDA552 for ; Fri, 7 Oct 2005 08:14:05 -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 07543-02 for ; Fri, 7 Oct 2005 11:13:57 +0000 (GMT) Received: from ns2.dialtelecom.sk (ns2.dialtelecom.sk [217.67.16.3]) by svr1.postgresql.org (Postfix) with ESMTP id B8BCADA52C for ; Fri, 7 Oct 2005 08:13:57 -0300 (ADT) Received: (qmail 7004 invoked by uid 0); 7 Oct 2005 11:14:00 -0000 Received: from unknown (HELO omikron.sk) (217.67.24.100) by ns2.dialtelecom.sk with SMTP; 7 Oct 2005 11:14:00 -0000 Received: (qmail 7604 invoked from network); 7 Oct 2005 11:14:00 -0000 Received: from unknown (HELO stratos) (158.195.31.19) by 0 with SMTP; 7 Oct 2005 11:14:00 -0000 Message-ID: <9fbe01c5cb30$4407d580$131fc39e@stratos> From: "Cestmir Hybl" To: "Steinar H. Gunderson" , References: <935801c5cb20$dcf93a00$131fc39e@stratos> <20051007104816.GA8371@uio.no> Subject: Re: count(*) using index scan in "query often, update rarely" environment Date: Fri, 7 Oct 2005 13:14:20 +0200 Organization: NUSTEP s.r.o. MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="utf-8"; reply-type=original Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.2527 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2527 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.024 required=5 tests=[AWL=0.024] X-Spam-Level: X-Archive-Number: 200510/138 X-Sequence-Number: 14906 collision: it's possible to either block updating transaction until index scan ends or discard index scan imediately and finish query using MVCC compliant scan dead rows: this sounds like more serious counter-argument, I don't know much about dead records management and whether it would be possible/worth to make indexes matching live records when there's no transaction in progress on that table ----- Original Message ----- From: "Steinar H. Gunderson" To: Sent: Friday, October 07, 2005 12:48 PM Subject: Re: [PERFORM] count(*) using index scan in "query often, update rarely" environment > 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/ > > ---------------------------(end of broadcast)--------------------------- > TIP 2: Don't 'kill -9' the postmaster