From a96c41feec6b6616eb9d5baee9a9e08c20533c38 Mon Sep 17 00:00:00 2001 From: Robert Haas Date: Thu, 4 Apr 2019 14:58:53 -0400 Subject: Allow VACUUM to be run with index cleanup disabled. This commit adds a new reloption, vacuum_index_cleanup, which controls whether index cleanup is performed for a particular relation by default. It also adds a new option to the VACUUM command, INDEX_CLEANUP, which can be used to override the reloption. If neither the reloption nor the VACUUM option is used, the default is true, as before. Masahiko Sawada, reviewed and tested by Nathan Bossart, Alvaro Herrera, Kyotaro Horiguchi, Darafei Praliaskouski, and me. The wording of the documentation is mostly due to me. Discussion: http://postgr.es/m/CAD21AoAt5R3DNUZSjOoXDUY=naYPUOuffVsRzuTYMz29yLzQCA@mail.gmail.com --- doc/src/sgml/ref/create_table.sgml | 15 +++++++++++++++ doc/src/sgml/ref/vacuum.sgml | 23 +++++++++++++++++++++++ 2 files changed, 38 insertions(+) (limited to 'doc/src') diff --git a/doc/src/sgml/ref/create_table.sgml b/doc/src/sgml/ref/create_table.sgml index 85c0ec1b318..1a8184e3063 100644 --- a/doc/src/sgml/ref/create_table.sgml +++ b/doc/src/sgml/ref/create_table.sgml @@ -1389,6 +1389,21 @@ WITH ( MODULUS numeric_literal, REM + + vacuum_index_cleanup (boolean) + + + Enables or disables index cleanup when VACUUM is + run on this table. The default value is true. + Disabling index cleanup can speed up VACUUM very + significantly, but may also lead to severely bloated indexes if table + modifications are frequent. The INDEX_CLEANUP + parameter to , if specified, overrides + the value of this option. + + + + autovacuum_vacuum_threshold, toast.autovacuum_vacuum_threshold (integer) diff --git a/doc/src/sgml/ref/vacuum.sgml b/doc/src/sgml/ref/vacuum.sgml index 906d0c2ad7c..fdd81512209 100644 --- a/doc/src/sgml/ref/vacuum.sgml +++ b/doc/src/sgml/ref/vacuum.sgml @@ -32,6 +32,7 @@ VACUUM [ FULL ] [ FREEZE ] [ VERBOSE ] [ ANALYZE ] [ boolean ] DISABLE_PAGE_SKIPPING [ boolean ] SKIP_LOCKED [ boolean ] + INDEX_CLEANUP [ boolean ] and table_and_columns is: @@ -181,6 +182,28 @@ VACUUM [ FULL ] [ FREEZE ] [ VERBOSE ] [ ANALYZE ] [ ). However, if index + cleanup is not performed regularly, performance may suffer, because + as the table is modified, indexes will accumulate dead tuples + and the table itself will accumulate dead line pointers that cannot be + removed until index cleanup is completed. This option has no effect + for tables that do not have an index and is ignored if the + FULL is used. + + + + boolean -- cgit v1.2.3