Add support for index-only scans in GiST.
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>
Thu, 26 Mar 2015 17:12:00 +0000 (19:12 +0200)
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>
Thu, 26 Mar 2015 17:12:00 +0000 (19:12 +0200)
commitd04c8ed9044eccebce043143a930617e3998c005
treee0167be995bb28dab91dfb92f1e18609e91a0d3e
parent8fa393a6d739796d9f06a7fba91d7e1d0c354879
Add support for index-only scans in GiST.

This adds a new GiST opclass method, 'fetch', which is used to reconstruct
the original Datum from the value stored in the index. Also, the 'canreturn'
index AM interface function gains a new 'attno' argument. That makes it
possible to use index-only scans on a multi-column index where some of the
opclasses support index-only scans but some do not.

This patch adds support in the box and point opclasses. Other opclasses
can added later as follow-on patches (btree_gist would be particularly
interesting).

Anastasia Lubennikova, with additional fixes and modifications by me.
24 files changed:
doc/src/sgml/catalogs.sgml
doc/src/sgml/gist.sgml
doc/src/sgml/indexam.sgml
src/backend/access/gist/gist.c
src/backend/access/gist/gistget.c
src/backend/access/gist/gistproc.c
src/backend/access/gist/gistscan.c
src/backend/access/gist/gistutil.c
src/backend/access/index/indexam.c
src/backend/access/spgist/spgscan.c
src/backend/optimizer/path/indxpath.c
src/backend/optimizer/util/plancat.c
src/include/access/genam.h
src/include/access/gist.h
src/include/access/gist_private.h
src/include/catalog/catversion.h
src/include/catalog/pg_am.h
src/include/catalog/pg_amproc.h
src/include/catalog/pg_proc.h
src/include/nodes/relation.h
src/include/utils/geo_decls.h
src/test/regress/expected/create_index.out
src/test/regress/expected/gist.out
src/test/regress/sql/gist.sql