pgsql: Improve index-only scans to avoid repeated access to the index p

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Improve index-only scans to avoid repeated access to the index p
Date: 2011-10-09 04:21:39
Message-ID: E1RCktP-0008Fy-Nw@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/cbfa92c23c3924d53889320cdbe26f23ee23e40c

Modified Files
--------------
doc/src/sgml/indexam.sgml | 11 ++--
src/backend/access/index/indexam.c | 7 +-
src/backend/access/nbtree/nbtree.c | 120 ++++++++-------------------------
src/backend/access/nbtree/nbtsearch.c | 68 +++++++++++++++----
src/backend/access/nbtree/nbtutils.c | 39 ++++++-----
src/backend/executor/nodeIndexscan.c | 2 +-
src/include/access/nbtree.h | 22 ++++++-
src/include/access/relscan.h | 2 +-
8 files changed, 136 insertions(+), 135 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Heikki Linnakangas 2011-10-09 16:00:34 pgsql: Clean up a couple of box gist helper functions.
Previous Message Tom Lane 2011-10-08 15:09:27 pgsql: Note that index-only scans can affect idx_tup_fetch.