From: Andrew Sullivan <ajs@crankycanuck.ca>
To: pgsql-sql@postgresql.org
Subject: Re: Make COUNT(*) Faster?
Date: Fri, 8 Jul 2005 11:31:00 -0400
Message-ID: <20050708153100.GC21449@phlogiston.dyndns.org> (raw)
In-Reply-To: <42CE96AF.3020903@noao.edu>
References: <9EF2931D-1097-470D-8ECB-59D00166C96F@apple.com>
<60vf3mklue.fsf@dba2.int.libertyrms.com>
<42CE89CA.2070607@noao.edu>
<20050708143508.GD22725@wolff.to>
<42CE96AF.3020903@noao.edu>
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
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-sql@postgresql.org
Cc: ajs@crankycanuck.ca
Subject: Re: Make COUNT(*) Faster?
In-Reply-To: <20050708153100.GC21449@phlogiston.dyndns.org>
* 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