Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
Thread:
Lists: pgsql-announcepgsql-hackerspgsql-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

pgsql-announce by date

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

pgsql-hackers by date

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

pgsql-patches by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group