pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Steinar H. Gunderson <sgunderson@bigfoot.com>
To: pgsql-performance@postgresql.org
Subject: Re: count(*) using index scan in "query often, update rarely" environment
Date: Fri, 7 Oct 2005 12:48:16 +0200
Message-ID: <20051007104816.GA8371@uio.no> (raw)
In-Reply-To: <935801c5cb20$dcf93a00$131fc39e@stratos>
References: <935801c5cb20$dcf93a00$131fc39e@stratos>

On Fri, Oct 07, 2005 at 11:24:05AM +0200, Cestmir Hybl 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?

Even if there is no running update, there might still be dead rows in the
table. In any case, of course, a new update could always be occurring while
your counting query was still running.

/* Steinar */
-- 
Homepage: http://www.sesse.net/



view thread (11+ messages)  latest in thread

Message-ID: <20051007104816.GA8371@uio.no>
Permalink:  ../20051007104816.GA8371@uio.no/
Also on:    postgresql.org/message-id/20051007104816.GA8371@uio.no

 · 

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: sgunderson@bigfoot.com
  Subject: Re: count(*) using index scan in "query often, update rarely" environment
  In-Reply-To: <20051007104816.GA8371@uio.no>

* 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