From cbfa92c23c3924d53889320cdbe26f23ee23e40c Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Sun, 9 Oct 2011 00:21:08 -0400 Subject: Improve index-only scans to avoid repeated access to the index page. We copy all the matched tuples off the page during _bt_readpage, instead of expensively re-locking the page during each subsequent tuple fetch. This costs a bit more local storage, but not more than 2*BLCKSZ worth, and the reduction in LWLock traffic is certainly worth that. What's more, this lets us get rid of the API wart in the original patch that said an index AM could randomly decline to supply an index tuple despite having asserted pg_am.amcanreturn. That will be important for future improvements in the index-only-scan feature, since the executor will now be able to rely on having the index data available. --- src/include/access/relscan.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/include/access/relscan.h') diff --git a/src/include/access/relscan.h b/src/include/access/relscan.h index 656aefccee..d48bbf865e 100644 --- a/src/include/access/relscan.h +++ b/src/include/access/relscan.h @@ -79,7 +79,7 @@ typedef struct IndexScanDescData void *opaque; /* access-method-specific info */ /* in an index-only scan, this is valid after a successful amgettuple */ - IndexTuple xs_itup; /* index tuple returned by AM, or NULL */ + IndexTuple xs_itup; /* index tuple returned by AM */ /* xs_ctup/xs_cbuf/xs_recheck are valid after a successful index_getnext */ HeapTupleData xs_ctup; /* current heap tuple, if any */ -- cgit v1.2.1