Re: COUNT(*) and index-only scans - Mailing list pgsql-hackers

From Kevin Grittner
Subject Re: COUNT(*) and index-only scans
Date
Msg-id 4E956B3E0200002500041EAA@gw.wicourts.gov
Whole thread Raw
In response to Re: COUNT(*) and index-only scans  (Aidan Van Dyk <aidan@highrise.ca>)
Responses Re: COUNT(*) and index-only scans
List pgsql-hackers
Aidan Van Dyk <aidan@highrise.ca> wrote:
> The elephant in the room is that the index-only-scan really
> doesn't save a *whole* lot if the heap pages are already in shared
> buffers.
It's not hard to create a simple test case where it's about three
times slower to go to cached heap pages than to use the values from
the index.  That was just my first try, so it's not likely to be a
real "worst case", although was using the default shared_memory
size, so a lot of the heap pages probably came from the OS cache,
rather than being in shared memory.
> But it matters a *lot* when they heap pages are not in shared
> buffers
Yeah, obviously it matters more if you actually need to add a random
disk read.
-Kevin


pgsql-hackers by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: [BUGS] *.sql contrib files contain unresolvable MODULE_PATHNAME
Next
From: Greg Stark
Date:
Subject: Re: COUNT(*) and index-only scans