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 C012EDA53B for ; Fri, 7 Oct 2005 06:54:28 -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 45227-10 for ; Fri, 7 Oct 2005 09:54:20 +0000 (GMT) Received: from qproxy.gmail.com (qproxy.gmail.com [72.14.204.202]) by svr1.postgresql.org (Postfix) with ESMTP id B4559DA521 for ; Fri, 7 Oct 2005 06:54:20 -0300 (ADT) Received: by qproxy.gmail.com with SMTP id z1so493320qbc for ; Fri, 07 Oct 2005 02:54:23 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:references; b=f9Ud/9vObec/4Xia9lDNm6b0ruhD6PZs7JD/zlvLtaR5QEOuVC0FL6lPBt7fAfYWtxu0Wzl6QjZCQpqhzoBP0hYmSLDn0XJW+5rAi7u7bXG6aicnh7MXwXiBy4JiFAjSbBLgnE4J0+pSkNCM6Uz+HrcFpYAXYkcf6c5ljaQZEfE= Received: by 10.64.209.15 with SMTP id h15mr241562qbg; Fri, 07 Oct 2005 02:54:23 -0700 (PDT) Received: by 10.64.195.4 with HTTP; Fri, 7 Oct 2005 02:54:23 -0700 (PDT) Message-ID: <9e4684ce0510070254v67e08bcfhb725715803a5de25@mail.gmail.com> Date: Fri, 7 Oct 2005 11:54:23 +0200 From: hubert depesz lubaczewski Reply-To: hubert depesz lubaczewski To: Cestmir Hybl Subject: Re: count(*) using index scan in "query often, update rarely" environment Cc: pgsql-performance@postgresql.org In-Reply-To: <935801c5cb20$dcf93a00$131fc39e@stratos> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_10913_26676785.1128678863681" References: <935801c5cb20$dcf93a00$131fc39e@stratos> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.144 required=5 tests=[AWL=1.033, HTML_40_50=0.086, HTML_MESSAGE=0.001, RCVD_BY_IP=0.024] X-Spam-Level: * X-Archive-Number: 200510/135 X-Sequence-Number: 14903 ------=_Part_10913_26676785.1128678863681 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On 10/7/05, Cestmir Hybl wrote: > > Isn't it possible (and reasonable) for these environments to keep track o= f > 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? > if i understand your problem correctly, then simple usage of triggers will do the job just fine. hubert ------=_Part_10913_26676785.1128678863681 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On 10/7/05, Cestmir Hybl <cestmirl@freeside.sk> wrote:
Isn't it possible (and reasonable) for= these=20 environments to keep track of whether there is a transaction in progress wi= th=20 update to given table and if not, use an index scan (count(*) where) or cac= hed=20 value (count(*)) to perform this kind of query?

if i understand your problem correctly, then simple usage of triggers will = do the job just fine.

hubert
------=_Part_10913_26676785.1128678863681--