1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-30 11:03:19 +03:00

Add --schema and --exclude-schema options to vacuumdb.

These two new options can be used to either process all tables in
specific schemas or to skip processing all tables in specific
schemas.  This change also refactors the handling of invalid
combinations of command-line options to a new helper function.

Author: Gilles Darold
Reviewed-by: Justin Pryzby, Nathan Bossart and Michael Paquier.
Discussion: https://postgr.es/m/929fbf3c-24b8-d454-811f-1d5898ab3e91%40migops.com
This commit is contained in:
Andrew Dunstan
2022-07-31 16:41:50 -04:00
parent e1c95e50e9
commit 7781f4e3e7
3 changed files with 239 additions and 41 deletions

View File

@ -39,6 +39,40 @@ PostgreSQL documentation
<arg choice="opt"><replaceable>dbname</replaceable></arg>
</cmdsynopsis>
<cmdsynopsis>
<command>vacuumdb</command>
<arg rep="repeat"><replaceable>connection-option</replaceable></arg>
<arg rep="repeat"><replaceable>option</replaceable></arg>
<arg choice="plain" rep="repeat">
<arg choice="opt">
<group choice="plain">
<arg choice="plain">
<arg choice="opt">
<group choice="plain">
<arg choice="plain"><option>-n</option></arg>
<arg choice="plain"><option>--schema</option></arg>
</group>
<replaceable>schema</replaceable>
</arg>
</arg>
<arg choice="plain">
<arg choice="opt">
<group choice="plain">
<arg choice="plain"><option>-N</option></arg>
<arg choice="plain"><option>--exclude-schema</option></arg>
</group>
<replaceable>schema</replaceable>
</arg>
</arg>
</group>
</arg>
</arg>
<arg choice="opt"><replaceable>dbname</replaceable></arg>
</cmdsynopsis>
<cmdsynopsis>
<command>vacuumdb</command>
<arg rep="repeat"><replaceable>connection-option</replaceable></arg>
@ -244,6 +278,30 @@ PostgreSQL documentation
</listitem>
</varlistentry>
<varlistentry>
<term><option>-n <replaceable class="parameter">schema</replaceable></option></term>
<term><option>--schema=<replaceable class="parameter">schema</replaceable></option></term>
<listitem>
<para>
Clean or analyze all tables in
<replaceable class="parameter">schema</replaceable> only. Multiple
schemas can be vacuumed by writing multiple <option>-n</option> switches.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-N <replaceable class="parameter">schema</replaceable></option></term>
<term><option>--exclude-schema=<replaceable class="parameter">schema</replaceable></option></term>
<listitem>
<para>
Do not clean or analyze any tables in
<replaceable class="parameter">schema</replaceable>. Multiple schemas
can be excluded by writing multiple <option>-N</option> switches.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>--no-index-cleanup</option></term>
<listitem>
@ -619,6 +677,14 @@ PostgreSQL documentation
<prompt>$ </prompt><userinput>vacuumdb --analyze --verbose --table='foo(bar)' xyzzy</userinput>
</screen></para>
<para>
To clean all tables in the <literal>foo</literal> and <literal>bar</literal> schemas
in a database named <literal>xyzzy</literal>:
<screen>
<prompt>$ </prompt><userinput>vacuumdb --schema='foo' --schema='bar' xyzzy</userinput>
</screen></para>
</refsect1>
<refsect1>