postgresql/contrib
Alexander Korotkov 4b754d6c16 Avoid full scan of GIN indexes when possible
The strategy of GIN index scan is driven by opclass-specific extract_query
method.  This method that needed search mode is GIN_SEARCH_MODE_ALL.  This
mode means that matching tuple may contain none of extracted entries.  Simple
example is '!term' tsquery, which doesn't need any term to exist in matching
tsvector.

In order to handle such scan key GIN calculates virtual entry, which contains
all TIDs of all entries of attribute.  In fact this is full scan of index
attribute.  And typically this is very slow, but allows to handle some queries
correctly in GIN.  However, current algorithm calculate such virtual entry for
each GIN_SEARCH_MODE_ALL scan key even if they are multiple for the same
attribute.  This is clearly not optimal.

This commit improves the situation by introduction of "exclude only" scan keys.
Such scan keys are not capable to return set of matching TIDs.  Instead, they
are capable only to filter TIDs produced by normal scan keys.  Therefore,
each attribute should contain at least one normal scan key, while rest of them
may be "exclude only" if search mode is GIN_SEARCH_MODE_ALL.

The same optimization might be applied to the whole scan, not per-attribute.
But that leads to NULL values elimination problem.  There is trade-off between
multiple possible ways to do this.  We probably want to do this later using
some cost-based decision algorithm.

Discussion: https://postgr.es/m/CAOBaU_YGP5-BEt5Cc0%3DzMve92vocPzD%2BXiZgiZs1kjY0cj%3DXBg%40mail.gmail.com
Author: Nikita Glukhov, Alexander Korotkov, Tom Lane, Julien Rouhaud
Reviewed-by: Julien Rouhaud, Tomas Vondra, Tom Lane
2020-01-18 01:11:39 +03:00
..
adminpack Update copyrights for 2020 2020-01-01 12:21:45 -05:00
amcheck Update copyrights for 2020 2020-01-01 12:21:45 -05:00
auth_delay Update copyrights for 2020 2020-01-01 12:21:45 -05:00
auto_explain Update copyrights for 2020 2020-01-01 12:21:45 -05:00
bloom Introduce IndexAM fields for parallel vacuum. 2020-01-15 07:24:14 +05:30
btree_gin Split all OBJS style lines in makefiles into one-line-per-entry style. 2019-11-05 14:41:07 -08:00
btree_gist Make the order of the header file includes consistent. 2019-11-25 08:08:57 +05:30
citext Fix typos in various places 2019-06-03 13:44:03 +09:00
cube Split all OBJS style lines in makefiles into one-line-per-entry style. 2019-11-05 14:41:07 -08:00
dblink Update copyrights for 2020 2020-01-01 12:21:45 -05:00
dict_int Update copyrights for 2020 2020-01-01 12:21:45 -05:00
dict_xsyn Update copyrights for 2020 2020-01-01 12:21:45 -05:00
earthdistance Fix earthdistance test suite function name typo. 2018-07-29 12:02:07 -07:00
file_fdw Update copyrights for 2020 2020-01-01 12:21:45 -05:00
fuzzystrmatch Update copyrights for 2020 2020-01-01 12:21:45 -05:00
hstore Add reusable routine for making arrays unique. 2019-11-07 17:00:48 +13:00
hstore_plperl Split all OBJS style lines in makefiles into one-line-per-entry style. 2019-11-05 14:41:07 -08:00
hstore_plpython Split all OBJS style lines in makefiles into one-line-per-entry style. 2019-11-05 14:41:07 -08:00
intagg Schema-qualify some references to regprocedure. 2016-06-10 10:41:58 -04:00
intarray Update copyrights for 2020 2020-01-01 12:21:45 -05:00
isn Update copyrights for 2020 2020-01-01 12:21:45 -05:00
jsonb_plperl Split all OBJS style lines in makefiles into one-line-per-entry style. 2019-11-05 14:41:07 -08:00
jsonb_plpython Split all OBJS style lines in makefiles into one-line-per-entry style. 2019-11-05 14:41:07 -08:00
lo lo: Add test suite 2017-09-14 22:22:59 -04:00
ltree Remove useless "return;" lines 2019-11-28 16:48:37 -03:00
ltree_plpython Split all OBJS style lines in makefiles into one-line-per-entry style. 2019-11-05 14:41:07 -08:00
oid2name Split all OBJS style lines in makefiles into one-line-per-entry style. 2019-11-05 14:41:07 -08:00
pageinspect Update copyrights for 2020 2020-01-01 12:21:45 -05:00
passwordcheck Update copyrights for 2020 2020-01-01 12:21:45 -05:00
pg_buffercache Split all OBJS style lines in makefiles into one-line-per-entry style. 2019-11-05 14:41:07 -08:00
pg_freespacemap Split all OBJS style lines in makefiles into one-line-per-entry style. 2019-11-05 14:41:07 -08:00
pg_prewarm Update copyrights for 2020 2020-01-01 12:21:45 -05:00
pg_standby Remove useless "return;" lines 2019-11-28 16:48:37 -03:00
pg_stat_statements Update copyrights for 2020 2020-01-01 12:21:45 -05:00
pg_trgm Avoid full scan of GIN indexes when possible 2020-01-18 01:11:39 +03:00
pg_visibility Update copyrights for 2020 2020-01-01 12:21:45 -05:00
pgcrypto Update copyrights for 2020 2020-01-01 12:21:45 -05:00
pgrowlocks Split all OBJS style lines in makefiles into one-line-per-entry style. 2019-11-05 14:41:07 -08:00
pgstattuple Update copyrights for 2020 2020-01-01 12:21:45 -05:00
postgres_fdw Only superuser can set sslcert/sslkey in postgres_fdw user mappings 2020-01-13 18:08:09 +10:30
seg Remove useless "return;" lines 2019-11-28 16:48:37 -03:00
sepgsql Update copyrights for 2020 2020-01-01 12:21:45 -05:00
spi Remove dependency to system calls for memory allocation in refint 2020-01-08 10:02:55 +09:00
sslinfo Split all OBJS style lines in makefiles into one-line-per-entry style. 2019-11-05 14:41:07 -08:00
start-scripts Remove contrib/start-scripts/osx/. 2017-11-17 12:53:20 -05:00
tablefunc Update copyrights for 2020 2020-01-01 12:21:45 -05:00
tcn Update copyrights for 2020 2020-01-01 12:21:45 -05:00
test_decoding Update copyrights for 2020 2020-01-01 12:21:45 -05:00
tsm_system_rows Update copyrights for 2020 2020-01-01 12:21:45 -05:00
tsm_system_time Update copyrights for 2020 2020-01-01 12:21:45 -05:00
unaccent Add support for automatically updating Unicode derived files 2020-01-09 10:08:14 +01:00
uuid-ossp Update copyrights for 2020 2020-01-01 12:21:45 -05:00
vacuumlo Update copyrights for 2020 2020-01-01 12:21:45 -05:00
xml2 Split all OBJS style lines in makefiles into one-line-per-entry style. 2019-11-05 14:41:07 -08:00
Makefile Transforms for jsonb to PL/Perl 2018-04-03 09:47:18 -04:00
README Rename 'gmake' to 'make' in docs and recommended commands 2014-02-12 17:29:19 -05:00
contrib-global.mk Respect TEMP_CONFIG when pg_regress_check and friends are called 2016-02-27 12:28:21 -05:00

README

The PostgreSQL contrib tree
---------------------------

This subtree contains porting tools, analysis utilities, and plug-in
features that are not part of the core PostgreSQL system, mainly
because they address a limited audience or are too experimental to be
part of the main source tree.  This does not preclude their
usefulness.

User documentation for each module appears in the main SGML
documentation.

When building from the source distribution, these modules are not
built automatically, unless you build the "world" target.  You can
also build and install them all by running "make all" and "make
install" in this directory; or to build and install just one selected
module, do the same in that module's subdirectory.

Some directories supply new user-defined functions, operators, or
types.  To make use of one of these modules, after you have installed
the code you need to register the new SQL objects in the database
system by executing a CREATE EXTENSION command.  In a fresh database,
you can simply do

    CREATE EXTENSION module_name;

See the PostgreSQL documentation for more information about this
procedure.