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

From: "Steinar H(dot) Gunderson" <sgunderson(at)bigfoot(dot)com>
To: pgsql-performance(at)postgresql(dot)org
Subject: Re: count(*) using index scan in "query often, update rarely" environment
Date: 2005-10-07 10:48:16
Message-ID: 20051007104816.GA8371@uio.no
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

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/

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Cestmir Hybl 2005-10-07 11:14:20 Re: count(*) using index scan in "query often, update rarely" environment
Previous Message Cestmir Hybl 2005-10-07 10:14:29 Re: count(*) using index scan in "query often, update rarely" environment