Re: the big picture for index-only scans - Mailing list pgsql-hackers

From Kevin Grittner
Subject Re: the big picture for index-only scans
Date
Msg-id 4DCA5907020000250003D559@gw.wicourts.gov
Whole thread Raw
In response to Re: the big picture for index-only scans  (Bruce Momjian <bruce@momjian.us>)
List pgsql-hackers
Bruce Momjian <bruce@momjian.us> wrote:
>> The very fact that Kevin and yourself bring up different reasons
>> for why we need this feature makes me nervous.
> 
> Yes, no question.  For count(*), you don't care about the indexed
> values, only the count, while for Kevin's case you are reading
> values from the index.
[sigh]  I'm reluctant to draw out this digression further, but there
is a possibly-useful point to be made here: these are not two
different things.  A covering index can be considered whenever the
set of columns referenced in the query is contained inside the set
of columns in the index.  The fact that the set of columns needed by
count(*) is the empty set merely means that it is covered by any
index, since the empty set is contained in every set.
Now, this special case may make for an easy initial target in
implementation, or allow early benchmarking.  If so, all the better
to go there first.  I'm not sure why anyone would stop there,
though; if it pays off for that simple case it is likely to pay off
for the more general case, too.
-Kevin


pgsql-hackers by date:

Previous
From: Greg Stark
Date:
Subject: Re: PGC_S_DEFAULT is inadequate
Next
From: Tom Lane
Date:
Subject: Re: the big picture for index-only scans