Re: Much Ado About COUNT(*) - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Much Ado About COUNT(*)
Date
Msg-id 541.1105558916@sss.pgh.pa.us
Whole thread Raw
In response to Re: Much Ado About COUNT(*)  ("Jonah H. Harris" <jharris@tvi.edu>)
Responses Re: Much Ado About COUNT(*)  ("Jonah H. Harris" <jharris@tvi.edu>)
Re: Much Ado About COUNT(*)  (Christopher Kings-Lynne <chriskl@familyhealth.com.au>)
List pgsql-hackers
"Jonah H. Harris" <jharris@tvi.edu> writes:
> My thinking is that we may be able to implement index usage for not only 
> unqualified counts, but also on any query that can be satisfied by the 
> index itself.

The fundamental problem is that you can't do it without adding at least
16 bytes, probably 20, to the size of an index tuple header.  That would
double the physical size of an index on a simple column (eg an integer
or timestamp).  The extra I/O costs and extra maintenance costs are
unattractive to say the least.  And it takes away some of the
justification for the whole thing, which is that reading an index is
much cheaper than reading the main table.  That's only true if the index
is much smaller than the main table ...
        regards, tom lane


pgsql-hackers by date:

Previous
From: "Jonah H. Harris"
Date:
Subject: Re: Much Ado About COUNT(*)
Next
From: "Merlin Moncure"
Date:
Subject: Re: Much Ado About COUNT(*)