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

From: "Cestmir Hybl" <cestmirl(at)freeside(dot)sk>
To: <pgsql-performance(at)postgresql(dot)org>
Subject: count(*) using index scan in "query often, update rarely" environment
Date: 2005-10-07 09:24:05
Message-ID: 935801c5cb20$dcf93a00$131fc39e@stratos
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Hello all

First of all, I do understand why pgsql with it's MVCC design has to examine tuples to evaluate "count(*)" and "count(*) where (...)" queries in environment with heavy concurrent updates.

This kind of usage IMHO isn't the average one. There are many circumstances with rather "query often, update rarely" character.

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?

(sorry for disturbing if this was already discussed)

Regards,

Cestmir Hybl

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message hubert depesz lubaczewski 2005-10-07 09:54:23 Re: count(*) using index scan in "query often, update rarely" environment
Previous Message Richard Huxton 2005-10-07 07:52:46 Re: Need Some Suggestions