]> granicus.if.org Git - postgresql/commit
Improve index-only scans to avoid repeated access to the index page.
authorTom Lane <tgl@sss.pgh.pa.us>
Sun, 9 Oct 2011 04:21:08 +0000 (00:21 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Sun, 9 Oct 2011 04:21:08 +0000 (00:21 -0400)
commitcbfa92c23c3924d53889320cdbe26f23ee23e40c
treef93756a2e9f1d7e6cbf468b16528f275c04f04e5
parent45401c1c25fe1ef14bf68089de86bcb5cce9f453
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.
doc/src/sgml/indexam.sgml
src/backend/access/index/indexam.c
src/backend/access/nbtree/nbtree.c
src/backend/access/nbtree/nbtsearch.c
src/backend/access/nbtree/nbtutils.c
src/backend/executor/nodeIndexscan.c
src/include/access/nbtree.h
src/include/access/relscan.h