]> granicus.if.org Git - postgresql/commit
Support index-only scans using the visibility map to avoid heap fetches.
authorTom Lane <tgl@sss.pgh.pa.us>
Sat, 8 Oct 2011 00:13:02 +0000 (20:13 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Sat, 8 Oct 2011 00:14:13 +0000 (20:14 -0400)
commita2822fb9337a21f98ac4ce850bb4145acf47ca27
treec239fe9a32ff0225e906711a76348cee1567f0d8
parentcaa1054df8408b165e5f66ff25c87b6dd0a0a1e7
Support index-only scans using the visibility map to avoid heap fetches.

When a btree index contains all columns required by the query, and the
visibility map shows that all tuples on a target heap page are
visible-to-all, we don't need to fetch that heap page.  This patch depends
on the previous patches that made the visibility map reliable.

There's a fair amount left to do here, notably trying to figure out a less
chintzy way of estimating the cost of an index-only scan, but the core
functionality seems ready to commit.

Robert Haas and Ibrar Ahmed, with some previous work by Heikki Linnakangas.
34 files changed:
doc/src/sgml/catalogs.sgml
doc/src/sgml/config.sgml
doc/src/sgml/indexam.sgml
doc/src/sgml/ref/postgres-ref.sgml
src/backend/access/index/genam.c
src/backend/access/index/indexam.c
src/backend/access/nbtree/nbtree.c
src/backend/commands/explain.c
src/backend/executor/nodeIndexscan.c
src/backend/nodes/copyfuncs.c
src/backend/nodes/outfuncs.c
src/backend/optimizer/path/costsize.c
src/backend/optimizer/path/indxpath.c
src/backend/optimizer/plan/createplan.c
src/backend/optimizer/plan/planner.c
src/backend/optimizer/util/pathnode.c
src/backend/optimizer/util/plancat.c
src/backend/optimizer/util/var.c
src/backend/tcop/postgres.c
src/backend/utils/cache/relcache.c
src/backend/utils/misc/guc.c
src/backend/utils/misc/postgresql.conf.sample
src/include/access/genam.h
src/include/access/relscan.h
src/include/catalog/catversion.h
src/include/catalog/pg_am.h
src/include/nodes/execnodes.h
src/include/nodes/plannodes.h
src/include/nodes/relation.h
src/include/optimizer/cost.h
src/include/optimizer/pathnode.h
src/include/optimizer/var.h
src/test/regress/expected/aggregates.out
src/test/regress/expected/rangefuncs.out