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

From Heikki Linnakangas
Subject pgsql: Allow opclasses to provide tri-valued GIN consistent functions.
Date
Msg-id E1WNlSk-0006oh-Ez@gemulon.postgresql.org
Whole thread Raw
Responses Re: pgsql: Allow opclasses to provide tri-valued GIN consistent functions.
Re: pgsql: Allow opclasses to provide tri-valued GIN consistent functions.
List 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(-)


pgsql-committers by date:

Previous
From: Heikki Linnakangas
Date:
Subject: pgsql: In WAL replay, restore GIN metapage unconditionally to avoid tor
Next
From: Robert Haas
Date:
Subject: pgsql: Comment fixes related to logical decoding.