Add support for index-only scans in GiST.

Enterprise / PostgreSQL - Heikki Linnakangas [iki.fi] - 26 March 2015 12:12 UTC

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.

d04c8ed Add support for index-only scans in GiST.
doc/src/sgml/catalogs.sgml | 4 +-
doc/src/sgml/gist.sgml | 73 +++++++++++++-
doc/src/sgml/indexam.sgml | 15 +--
src/backend/access/gist/gist.c | 8 ++
src/backend/access/gist/gistget.c | 66 ++++++++++++-
src/backend/access/gist/gistproc.c | 37 +++++++
src/backend/access/gist/gistscan.c | 18 ++++
src/backend/access/gist/gistutil.c | 64 +++++++++++-
src/backend/access/index/indexam.c | 12 ++-
src/backend/access/spgist/spgscan.c | 1 +
src/backend/optimizer/path/indxpath.c | 22 +++--
src/backend/optimizer/util/plancat.c | 3 +-
src/include/access/genam.h | 2 +-
src/include/access/gist.h | 3 +-
src/include/access/gist_private.h | 9 +-
src/include/catalog/catversion.h | 2 +-
src/include/catalog/pg_am.h | 2 +-
src/include/catalog/pg_amproc.h | 2 +
src/include/catalog/pg_proc.h | 10 +-
src/include/nodes/relation.h | 3 +-
src/include/utils/geo_decls.h | 3 +
src/test/regress/expected/create_index.out | 70 ++++++-------
src/test/regress/expected/gist.out | 146 ++++++++++++++++++++++++++++
src/test/regress/sql/gist.sql | 73 ++++++++++++++
24 files changed, 575 insertions(+), 73 deletions(-)

Upstream: git.postgresql.org


  • Share