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

From: "Cestmir Hybl" <cestmirl(at)freeside(dot)sk>
To: "hubert depesz lubaczewski" <depesz(at)gmail(dot)com>
Cc: <pgsql-performance(at)postgresql(dot)org>
Subject: Re: count(*) using index scan in "query often, update rarely" environment
Date: 2005-10-07 10:14:29
Message-ID: 9d5b01c5cb27$e7a1c970$131fc39e@stratos
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Yes, I can possibly use triggers to maintanin counts of several fixed groups of records or total recordcount (but it's unpractical).

No, I can't speed-up evaluation of generic "count(*) where ()" queries this way.

My question was rather about general performance of count() queries in environment with infrequent updates.

Cestmir
----- Original Message -----
From: hubert depesz lubaczewski
To: Cestmir Hybl
Cc: pgsql-performance(at)postgresql(dot)org
Sent: Friday, October 07, 2005 11:54 AM
Subject: Re: [PERFORM] count(*) using index scan in "query often, update rarely" environment

On 10/7/05, Cestmir Hybl <cestmirl(at)freeside(dot)sk> 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?

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

hubert

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Steinar H. Gunderson 2005-10-07 10:48:16 Re: count(*) using index scan in "query often, update rarely" environment
Previous Message hubert depesz lubaczewski 2005-10-07 09:54:23 Re: count(*) using index scan in "query often, update rarely" environment