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 4F874DA590 for ; Sat, 8 Oct 2005 07:44:09 -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 29970-06 for ; Sat, 8 Oct 2005 10:44:06 +0000 (GMT) Received: from qproxy.gmail.com (qproxy.gmail.com [72.14.204.204]) by svr1.postgresql.org (Postfix) with ESMTP id 8624ED9D1F for ; Sat, 8 Oct 2005 07:44:06 -0300 (ADT) Received: by qproxy.gmail.com with SMTP id z1so647899qbc for ; Sat, 08 Oct 2005 03:44:09 -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=CC8+9nElxnYxl7kTrnoBtsrcp1P3BxtDGQ0a95nYXh1YuhaZOFOKqGQlZVSlHwJT3y7YVJ3rKsD1MCzFXnhIoelmNLRXumpup4IKMmnOsBh4Zlb6oTco/j/iacTrRy+didLZKuVCAFDV51PUqlT5PgNuNr0pkLji6Dx1fyLa3Qw= Received: by 10.64.196.3 with SMTP id t3mr1961096qbf; Sat, 08 Oct 2005 03:44:09 -0700 (PDT) Received: by 10.64.195.4 with HTTP; Sat, 8 Oct 2005 03:44:09 -0700 (PDT) Message-ID: <9e4684ce0510080344v1dfa36f7nea19ddb1ad38f652@mail.gmail.com> Date: Sat, 8 Oct 2005 12:44:09 +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: <9d5b01c5cb27$e7a1c970$131fc39e@stratos> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_25997_11295934.1128768249494" References: <935801c5cb20$dcf93a00$131fc39e@stratos> <9e4684ce0510070254v67e08bcfhb725715803a5de25@mail.gmail.com> <9d5b01c5cb27$e7a1c970$131fc39e@stratos> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.888 required=5 tests=[AWL=-0.055, HTML_40_50=0.086, HTML_MESSAGE=0.001, RCVD_BY_IP=0.024, RCVD_IN_BL_SPAMCOP_NET=1.832] X-Spam-Level: * X-Archive-Number: 200510/152 X-Sequence-Number: 14920 ------=_Part_25997_11295934.1128768249494 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On 10/7/05, Cestmir Hybl wrote: > > No, I can't speed-up evaluation of generic "count(*) where ()" queries > this way. > no you can't speed up generic where(), *but* you can check what are the mos= t common "where"'s (like usually i do where on one column like: select count(*) from table where some_particular_column =3D 'some value'; where you can simply make the trigger aware of the fact that it should coun= t based on value in some_particular_column. works good enough for me not to look for alternatives. depesz ------=_Part_25997_11295934.1128768249494 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:
No, I can't speed-up evaluation of gen= eric=20 "count(*) where ()" queries this way.

no you can't speed up generic where(), *but* you can check what are the most common "where"'s (like usually i do where on one column like= :
select count(*) from table where some_particular_column =3D 'some value'; where you can simply make the trigger aware of the fact that it should coun= t based on value in some_particular_column.
works good enough for me not to look for alternatives.

depesz


------=_Part_25997_11295934.1128768249494--