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

From Martijn van Oosterhout
Subject Re: Indices for select count(*)?
Date
Msg-id 20051223174154.GC27014@svana.org
Whole thread Raw
In response to Re: Indices for select count(*)?  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Indices for select count(*)?
Re: Indices for select count(*)?
List pgsql-general
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 don't think the planner objection need be taken too
> seriously: we already have a good big wart in there for recognizing
> MIN/MAX indexability, and this sort of transformation would fit pretty
> naturally with what's already done in planagg.c.

AFAICS two big problems with using an index type:

1. The index isn't told when the tuple is deleted.
2. The server expects to be able to lookup an index.

Other than that...

--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.

Attachment

pgsql-general by date:

Previous
From: Mag Gam
Date:
Subject: Isolate Logs
Next
From: Tom Lane
Date:
Subject: Re: Indices for select count(*)?