pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Cestmir Hybl <cestmirl@freeside.sk>
Cc: pgsql-performance@postgresql.org
Subject: Re: count(*) using index scan in "query often, update rarely" environment
Date: Fri, 07 Oct 2005 09:42:32 -0400
Message-ID: <3254.1128692552@sss.pgh.pa.us> (raw)
In-Reply-To: <935801c5cb20$dcf93a00$131fc39e@stratos>
References: <935801c5cb20$dcf93a00$131fc39e@stratos>

"Cestmir Hybl" <cestmirl@freeside.sk> writes:
> 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?

Please read the archives before bringing up such well-discussed issues.

There's a workable-looking design in the archives (pghackers probably)
for maintaining overall table counts in a separate table, with each
transaction adding one row of "delta" information just before it
commits.  I haven't seen anything else that looks remotely attractive.

			regards, tom lane



view thread (11+ messages)  latest in thread

Message-ID: <3254.1128692552@sss.pgh.pa.us>
Permalink:  ../3254.1128692552@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/3254.1128692552@sss.pgh.pa.us

 · 

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: tgl@sss.pgh.pa.us, cestmirl@freeside.sk
  Subject: Re: count(*) using index scan in "query often, update rarely" environment
  In-Reply-To: <3254.1128692552@sss.pgh.pa.us>

* 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