Re: Indices for select count(*)? - Mailing list pgsql-general

From Tom Lane
Subject Re: Indices for select count(*)?
Date
Msg-id 9979.1135377948@sss.pgh.pa.us
Whole thread Raw
In response to Re: Indices for select count(*)?  (Bruce Momjian <pgman@candle.pha.pa.us>)
List pgsql-general
Bruce Momjian <pgman@candle.pha.pa.us> writes:
>> On Fri, Dec 23, 2005 at 11:04:50AM -0500, Tom Lane wrote:
>>> It's not that easy --- in the MVCC world there simply isn't a unique
>>> count that is the right answer for every observer.  But the idea of
>>> packaging a count(*) mechanism as an index type seems like it might be
>>> a good one.

> I think our TODO has a good summary of the issues:

The point here was the idea that we might implement something like the
delta-counts approach, but package it to look like a specialized index
type --- as opposed to making the user create triggers and so on,
which'd surely be a lot more error-prone to set up.  Also, if it were
an index type then it would be relatively straighforward to get the
planner to recognize the availability of a substitute way of doing
COUNT(*).  We could do all this in other ways but it'd require more
new infrastructure.

The DELETE problem might kill the idea though.

            regards, tom lane

pgsql-general by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Indices for select count(*)?
Next
From: "CN"
Date:
Subject: Escaped backslash in SQL constant