Re: Make COUNT(*) Faster? - Mailing list pgsql-sql

From Andrew Sullivan
Subject Re: Make COUNT(*) Faster?
Date
Msg-id 20050708153100.GC21449@phlogiston.dyndns.org
Whole thread Raw
In response to Re: Make COUNT(*) Faster?  (Steve Wampler <swampler@noao.edu>)
List pgsql-sql
On Fri, Jul 08, 2005 at 08:07:27AM -0700, Steve Wampler wrote:
> Bruno Wolff III wrote:
> > No, it is an exact count.
> 
> Yes, for the transaction, but it's an approximation of the number of
> tuples in the table - which is probably what the people who worry about
> its cost are more interested in (an approximate count for the table).

You seem to have the wrong idea of "tuples in the table" here.  You
need to think harder about MVCC visibility rules.  Given MVCC,
there isn't really a "view from nowhere" in the system -- there's
just the idea of what tuple visibility.  For a little more, you might
want to look at the presentation Tom Lane made for this:

http://www.postgresql.org/files/developer/transactions.pdf

A  

-- 
Andrew Sullivan  | ajs@crankycanuck.ca
A certain description of men are for getting out of debt, yet are
against all taxes for raising money to pay it off.    --Alexander Hamilton


pgsql-sql by date:

Previous
From: Dawid Kuroczko
Date:
Subject: Re: Make COUNT(*) Faster?
Next
From: Dawid Kuroczko
Date:
Subject: Re: Make COUNT(*) Faster?