pgsql: Allow opclasses to provide tri-valued GIN consistent functions.

From: Heikki Linnakangas <heikki(dot)linnakangas(at)iki(dot)fi>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Allow opclasses to provide tri-valued GIN consistent functions.
Date: 2014-03-12 15:52:58
Message-ID: E1WNlSk-0006oh-Ez@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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.

Branch
------
master

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

Modified Files
--------------
doc/src/sgml/gin.sgml | 54 ++++++++++++++--
doc/src/sgml/xindex.sgml | 13 +++-
src/backend/access/gin/ginarrayproc.c | 84 ++++++++++++++++++++++++
src/backend/access/gin/ginlogic.c | 68 +++++++++++++++++--
src/backend/access/gin/ginutil.c | 28 +++++++-
src/backend/utils/adt/tsginidx.c | 104 +++++++++++++++++++++++++++++-
src/include/access/gin.h | 18 +++++-
src/include/access/gin_private.h | 15 +----
src/include/catalog/catversion.h | 2 +-
src/include/catalog/pg_am.h | 2 +-
src/include/catalog/pg_amproc.h | 31 +++++++++
src/include/catalog/pg_proc.h | 4 ++
src/include/tsearch/ts_utils.h | 1 +
src/include/utils/builtins.h | 1 +
src/test/regress/expected/opr_sanity.out | 77 +++++++++++-----------
src/test/regress/sql/opr_sanity.sql | 70 +++++++++++---------
16 files changed, 469 insertions(+), 103 deletions(-)

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Robert Haas 2014-03-12 18:06:08 pgsql: Comment fixes related to logical decoding.
Previous Message Heikki Linnakangas 2014-03-12 12:52:14 pgsql: In WAL replay, restore GIN metapage unconditionally to avoid tor