toast_vacuum_index_cleanup_v3.patch
application/x-patch
Filename: toast_vacuum_index_cleanup_v3.patch
Type: application/x-patch
Part: 0
Patch
Format: unified
Series: patch v3
| File | + | − |
|---|---|---|
| doc/src/sgml/ref/create_table.sgml | 1 | 1 |
| src/backend/access/common/reloptions.c | 1 | 1 |
| src/bin/psql/tab-complete.c | 1 | 0 |
| src/test/regress/expected/vacuum.out | 4 | 1 |
| src/test/regress/sql/vacuum.sql | 4 | 1 |
diff --git a/doc/src/sgml/ref/create_table.sgml b/doc/src/sgml/ref/create_table.sgml
index 44a61ef..1e1b0e8 100644
--- a/doc/src/sgml/ref/create_table.sgml
+++ b/doc/src/sgml/ref/create_table.sgml
@@ -1406,7 +1406,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
</varlistentry>
<varlistentry id="reloption-vacuum-index-cleanup" xreflabel="vacuum_index_cleanup">
- <term><literal>vacuum_index_cleanup</literal> (<type>boolean</type>)
+ <term><literal>vacuum_index_cleanup</literal>, <literal>toast.vacuum_index_cleanup</literal> (<type>boolean</type>)
<indexterm>
<primary><varname>vacuum_index_cleanup</varname> storage parameter</primary>
</indexterm>
diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index cfbabb5..022b3a0 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -147,7 +147,7 @@ static relopt_bool boolRelOpts[] =
{
"vacuum_index_cleanup",
"Enables index vacuuming and index cleanup",
- RELOPT_KIND_HEAP,
+ RELOPT_KIND_HEAP | RELOPT_KIND_TOAST,
ShareUpdateExclusiveLock
},
true
diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c
index e4c03de..e2aa738 100644
--- a/src/bin/psql/tab-complete.c
+++ b/src/bin/psql/tab-complete.c
@@ -1056,6 +1056,7 @@ static const char *const table_storage_parameters[] = {
"toast.autovacuum_vacuum_scale_factor",
"toast.autovacuum_vacuum_threshold",
"toast.log_autovacuum_min_duration",
+ "toast.vacuum_index_cleanup",
"toast.vacuum_truncate",
"toast_tuple_target",
"user_catalog_table",
diff --git a/src/test/regress/expected/vacuum.out b/src/test/regress/expected/vacuum.out
index 8353d84..bc43e82 100644
--- a/src/test/regress/expected/vacuum.out
+++ b/src/test/regress/expected/vacuum.out
@@ -81,7 +81,10 @@ SQL function "wrap_do_analyze" statement 1
VACUUM FULL vactst;
VACUUM (DISABLE_PAGE_SKIPPING) vaccluster;
-- INDEX_CLEANUP option
-CREATE TABLE no_index_cleanup (i INT PRIMARY KEY) WITH (vacuum_index_cleanup = false);
+CREATE TABLE no_index_cleanup (i INT PRIMARY KEY, t TEXT) WITH (vacuum_index_cleanup = false, toast.vacuum_index_cleanup = false);
+INSERT INTO no_index_cleanup(i, t) VALUES(1, repeat('1234567890',30000));
+SELECT relname as toastrel FROM pg_class WHERE oid = (SELECT reltoastrelid FROM pg_class WHERE relname = 'no_index_cleanup') \gset
+VACUUM pg_toast.:toastrel; -- vacuum toast table of no_index_cleanup with no index cleanup
VACUUM (INDEX_CLEANUP FALSE) vaccluster;
VACUUM (INDEX_CLEANUP FALSE) vactst; -- index cleanup option is ignored if no indexes
VACUUM (INDEX_CLEANUP FALSE, FREEZE TRUE) vaccluster;
diff --git a/src/test/regress/sql/vacuum.sql b/src/test/regress/sql/vacuum.sql
index a558580..5173539 100644
--- a/src/test/regress/sql/vacuum.sql
+++ b/src/test/regress/sql/vacuum.sql
@@ -63,7 +63,10 @@ VACUUM FULL vactst;
VACUUM (DISABLE_PAGE_SKIPPING) vaccluster;
-- INDEX_CLEANUP option
-CREATE TABLE no_index_cleanup (i INT PRIMARY KEY) WITH (vacuum_index_cleanup = false);
+CREATE TABLE no_index_cleanup (i INT PRIMARY KEY, t TEXT) WITH (vacuum_index_cleanup = false, toast.vacuum_index_cleanup = false);
+INSERT INTO no_index_cleanup(i, t) VALUES(1, repeat('1234567890',30000));
+SELECT relname as toastrel FROM pg_class WHERE oid = (SELECT reltoastrelid FROM pg_class WHERE relname = 'no_index_cleanup') \gset
+VACUUM pg_toast.:toastrel; -- vacuum toast table of no_index_cleanup with no index cleanup
VACUUM (INDEX_CLEANUP FALSE) vaccluster;
VACUUM (INDEX_CLEANUP FALSE) vactst; -- index cleanup option is ignored if no indexes
VACUUM (INDEX_CLEANUP FALSE, FREEZE TRUE) vaccluster;