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

From Bruce Momjian
Subject Re: the big picture for index-only scans
Date
Msg-id 201105110140.p4B1etP22085@momjian.us
Whole thread Raw
In response to Re: the big picture for index-only scans  (Greg Stark <gsstark@mit.edu>)
Responses Re: the big picture for index-only scans  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Greg Stark wrote:
> On Wed, May 11, 2011 at 1:47 AM, Bruce Momjian <bruce@momjian.us> wrote:
> > Isn't speeding up COUNT(*) a sufficient case because it will not have to
> > touch the heap in many cases?
> 
> Putting aside the politics questions, count(*) is an interesting case
> -- it exposes some of the unanswered questions about index-only scans.
> 
> The reason "select count(*)" might win would be because we could pick
> any index and do an index scan, relying on the visibility map to
> optimize away the heap reads. This is only going to be a win if a
> large fraction of the heap reads get optimized away.
> 
> It's going to be pretty tricky to determine in the optimizer a) which
> index will be cheapest and b) what fraction of index tuples will point

I assume the smallest non-partial index would be the cheapest index.

--  Bruce Momjian  <bruce@momjian.us>        http://momjian.us EnterpriseDB
http://enterprisedb.com
 + It's impossible for everything to be true. +


pgsql-hackers by date:

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