Re: Much Ado About COUNT(*)

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Jonah H(dot) Harris" <jharris(at)tvi(dot)edu>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Much Ado About COUNT(*)
Date: 2005-01-12 19:41:56
Message-ID: 541.1105558916@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-announce pgsql-hackers pgsql-patches

"Jonah H. Harris" <jharris(at)tvi(dot)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

In response to

Responses

Browse pgsql-announce by date

  From Date Subject
Next Message Jonah H. Harris 2005-01-12 19:52:53 Re: Much Ado About COUNT(*)
Previous Message Jonah H. Harris 2005-01-12 19:36:15 Re: Much Ado About COUNT(*)

Browse pgsql-hackers by date

  From Date Subject
Next Message Merlin Moncure 2005-01-12 19:47:07 Re: Much Ado About COUNT(*)
Previous Message Jonah H. Harris 2005-01-12 19:36:15 Re: Much Ado About COUNT(*)

Browse pgsql-patches by date

  From Date Subject
Next Message Jonah H. Harris 2005-01-12 19:52:53 Re: Much Ado About COUNT(*)
Previous Message Jonah H. Harris 2005-01-12 19:36:15 Re: Much Ado About COUNT(*)