]> granicus.if.org Git - postgresql/commit
Allow opclasses to provide tri-valued GIN consistent functions.
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>
Wed, 12 Mar 2014 15:13:22 +0000 (17:13 +0200)
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>
Wed, 12 Mar 2014 15:51:30 +0000 (17:51 +0200)
commitc5608ea26a1f51998ad3cf987c3f0bda643c87a8
treeea7370dc9696b18454f7102b3c26208455355d3c
parentfecfc2b913c4be5eeed24b32ef51a3239580bd1e
Allow opclasses to provide tri-valued GIN consistent functions.

With the GIN "fast scan" feature, GIN can skip items without fetching all
the keys for them, if it can prove that they don't match regardless of
those keys. So far, it has done the proving by calling the boolean
consistent function with all combinations of TRUE/FALSE for the unfetched
keys, but since that's O(n^2), it becomes unfeasible with more than a few
keys. We can avoid calling consistent with all the combinations, if we can
tell the operator class implementation directly which keys are unknown.

This commit includes a triConsistent function for the built-in array and
tsvector opclasses.

Alexander Korotkov, with some changes by me.
16 files changed:
doc/src/sgml/gin.sgml
doc/src/sgml/xindex.sgml
src/backend/access/gin/ginarrayproc.c
src/backend/access/gin/ginlogic.c
src/backend/access/gin/ginutil.c
src/backend/utils/adt/tsginidx.c
src/include/access/gin.h
src/include/access/gin_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/tsearch/ts_utils.h
src/include/utils/builtins.h
src/test/regress/expected/opr_sanity.out
src/test/regress/sql/opr_sanity.sql