pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: hubert depesz lubaczewski <depesz@gmail.com>
To: Cestmir Hybl <cestmirl@freeside.sk>
Cc: pgsql-performance@postgresql.org
Subject: Re: count(*) using index scan in "query often, update rarely" environment
Date: Sat, 8 Oct 2005 12:44:09 +0200
Message-ID: <9e4684ce0510080344v1dfa36f7nea19ddb1ad38f652@mail.gmail.com> (raw)
In-Reply-To: <9d5b01c5cb27$e7a1c970$131fc39e@stratos>
References: <935801c5cb20$dcf93a00$131fc39e@stratos>
	<9e4684ce0510070254v67e08bcfhb725715803a5de25@mail.gmail.com>
	<9d5b01c5cb27$e7a1c970$131fc39e@stratos>

On 10/7/05, Cestmir Hybl <cestmirl@freeside.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

view thread (11+ messages)  latest in thread

Message-ID: <9e4684ce0510080344v1dfa36f7nea19ddb1ad38f652@mail.gmail.com>
Permalink:  ../9e4684ce0510080344v1dfa36f7nea19ddb1ad38f652@mail.gmail.com/
Also on:    postgresql.org/message-id/9e4684ce0510080344v1dfa36f7nea19ddb1ad38f652@mail.gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: depesz@gmail.com, cestmirl@freeside.sk
  Subject: Re: count(*) using index scan in "query often, update rarely" environment
  In-Reply-To: <9e4684ce0510080344v1dfa36f7nea19ddb1ad38f652@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox