Re: count(*) using index scan in "query often, update rarely" environment

From: hubert depesz lubaczewski <depesz(at)gmail(dot)com>
To: Cestmir Hybl <cestmirl(at)freeside(dot)sk>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: count(*) using index scan in "query often, update rarely" environment
Date: 2005-10-08 10:44:09
Message-ID: 9e4684ce0510080344v1dfa36f7nea19ddb1ad38f652@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On 10/7/05, Cestmir Hybl <cestmirl(at)freeside(dot)sk> 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 most
common "where"'s (like usually i do where on one column like:
select count(*) from table where some_particular_column = 'some value';
where you can simply make the trigger aware of the fact that it should count
based on value in some_particular_column.
works good enough for me not to look for alternatives.

depesz

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message mark 2005-10-08 13:31:06 Re: [HACKERS] A Better External Sort?
Previous Message Luke Lonergan 2005-10-08 04:20:59 Re: [HACKERS] A Better External Sort?