postgresql/contrib
Teodor Sigaev 857f9c36cd Skip full index scan during cleanup of B-tree indexes when possible
Vacuum of index consists from two stages: multiple (zero of more) ambulkdelete
calls and one amvacuumcleanup call. When workload on particular table
is append-only, then autovacuum isn't intended to touch this table. However,
user may run vacuum manually in order to fill visibility map and get benefits
of index-only scans. Then ambulkdelete wouldn't be called for indexes
of such table (because no heap tuples were deleted), only amvacuumcleanup would
be called In this case, amvacuumcleanup would perform full index scan for
two objectives: put recyclable pages into free space map and update index
statistics.

This patch allows btvacuumclanup to skip full index scan when two conditions
are satisfied: no pages are going to be put into free space map and index
statistics isn't stalled. In order to check first condition, we store
oldest btpo_xact in the meta-page. When it's precedes RecentGlobalXmin, then
there are some recyclable pages. In order to check second condition we store
number of heap tuples observed during previous full index scan by cleanup.
If fraction of newly inserted tuples is less than
vacuum_cleanup_index_scale_factor, then statistics isn't considered to be
stalled. vacuum_cleanup_index_scale_factor can be defined as both reloption and GUC (default).

This patch bumps B-tree meta-page version. Upgrade of meta-page is performed
"on the fly": during VACUUM meta-page is rewritten with new version. No special
handling in pg_upgrade is required.

Author: Masahiko Sawada, Alexander Korotkov
Review by: Peter Geoghegan, Kyotaro Horiguchi, Alexander Korotkov, Yura Sokolov
Discussion: https://www.postgresql.org/message-id/flat/CAD21AoAX+d2oD_nrd9O2YkpzHaFr=uQeGr9s1rKC3O4ENc568g@mail.gmail.com
2018-04-04 19:29:00 +03:00
..
adminpack Update copyright for 2018 2018-01-02 23:30:12 -05:00
amcheck Skip full index scan during cleanup of B-tree indexes when possible 2018-04-04 19:29:00 +03:00
auth_delay Update copyright for 2018 2018-01-02 23:30:12 -05:00
auto_explain Allow auto_explain.log_min_duration to go up to INT_MAX. 2018-02-23 14:39:17 -05:00
bloom Fix errors in contrib/bloom index build. 2018-03-22 13:14:07 -04:00
btree_gin Phase 3 of pgindent updates. 2017-06-21 15:35:54 -04:00
btree_gist Fix assorted issues in convert_to_scalar(). 2018-03-03 20:31:35 -05:00
citext Disable multi-byte citext tests 2017-09-19 15:31:37 -04:00
cube llow negative coordinate for ~> (cube, int) operator 2018-01-11 14:49:36 +03:00
dblink Prevent accidental linking of system-supplied copies of libpq.so etc. 2018-04-03 16:26:05 -04:00
dict_int Avoid unnecessary use of pg_strcasecmp for already-downcased identifiers. 2018-01-26 18:25:14 -05:00
dict_xsyn Avoid unnecessary use of pg_strcasecmp for already-downcased identifiers. 2018-01-26 18:25:14 -05:00
earthdistance Phase 3 of pgindent updates. 2017-06-21 15:35:54 -04:00
file_fdw Improve style guideline compliance of assorted error-report messages. 2018-03-22 17:33:10 -04:00
fuzzystrmatch Update copyright for 2018 2018-01-02 23:30:12 -05:00
hstore Avoid formally-undefined use of memcpy() in hstoreUniquePairs(). 2017-11-25 14:42:10 -05:00
hstore_plperl Prevent accidental linking of system-supplied copies of libpq.so etc. 2018-04-03 16:26:05 -04:00
hstore_plpython Prevent accidental linking of system-supplied copies of libpq.so etc. 2018-04-03 16:26:05 -04:00
intagg Schema-qualify some references to regprocedure. 2016-06-10 10:41:58 -04:00
intarray Update copyright for 2018 2018-01-02 23:30:12 -05:00
isn Update copyright for 2018 2018-01-02 23:30:12 -05:00
jsonb_plperl Remove less-portable-than-believed test case. 2018-04-04 11:51:36 -04:00
jsonb_plpython Prevent accidental linking of system-supplied copies of libpq.so etc. 2018-04-03 16:26:05 -04:00
lo lo: Add test suite 2017-09-14 22:22:59 -04:00
ltree Change TRUE/FALSE to true/false 2017-11-08 11:37:28 -05:00
ltree_plpython Prevent accidental linking of system-supplied copies of libpq.so etc. 2018-04-03 16:26:05 -04:00
oid2name Prevent accidental linking of system-supplied copies of libpq.so etc. 2018-04-03 16:26:05 -04:00
pageinspect Skip full index scan during cleanup of B-tree indexes when possible 2018-04-04 19:29:00 +03:00
passwordcheck Update copyright for 2018 2018-01-02 23:30:12 -05:00
pg_buffercache Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
pg_freespacemap Default monitoring roles 2017-03-30 14:18:53 -04:00
pg_prewarm pg_prewarm: Add missing LWLockRegisterTranche call. 2018-01-31 15:12:33 -05:00
pg_standby Fix assorted infelicities in new SetWALSegSize() function. 2017-09-24 12:05:06 -04:00
pg_stat_statements Update copyright for 2018 2018-01-02 23:30:12 -05:00
pg_trgm Add strict_word_similarity to pg_trgm module 2018-03-21 14:57:42 +03:00
pg_visibility Update copyright for 2018 2018-01-02 23:30:12 -05:00
pgcrypto Fix a boatload of typos in C comments. 2018-04-01 15:01:28 -04:00
pgrowlocks Replace AclObjectKind with ObjectType 2018-01-19 14:01:15 -05:00
pgstattuple Skip full index scan during cleanup of B-tree indexes when possible 2018-04-04 19:29:00 +03:00
postgres_fdw Prevent accidental linking of system-supplied copies of libpq.so etc. 2018-04-03 16:26:05 -04:00
seg Support index-only scans in contrib/cube and contrib/seg GiST indexes. 2017-11-20 20:25:18 -05:00
sepgsql Remove stdbool workaround in sepgsql 2018-03-22 21:59:28 -04:00
spi Prevent accidental linking of system-supplied copies of libpq.so etc. 2018-04-03 16:26:05 -04:00
sslinfo Phase 3 of pgindent updates. 2017-06-21 15:35:54 -04:00
start-scripts Remove contrib/start-scripts/osx/. 2017-11-17 12:53:20 -05:00
tablefunc Update copyright for 2018 2018-01-02 23:30:12 -05:00
tcn Update copyright for 2018 2018-01-02 23:30:12 -05:00
test_decoding MERGE SQL Command following SQL:2016 2018-04-03 09:28:16 +01:00
tsm_system_rows Update copyright for 2018 2018-01-02 23:30:12 -05:00
tsm_system_time Update copyright for 2018 2018-01-02 23:30:12 -05:00
unaccent Avoid unnecessary use of pg_strcasecmp for already-downcased identifiers. 2018-01-26 18:25:14 -05:00
uuid-ossp Update copyright for 2018 2018-01-02 23:30:12 -05:00
vacuumlo Prevent accidental linking of system-supplied copies of libpq.so etc. 2018-04-03 16:26:05 -04:00
xml2 Phase 3 of pgindent updates. 2017-06-21 15:35:54 -04: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.