Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 11d8d72

Browse files
committed
Allow multiple tables to be specified in one VACUUM or ANALYZE command.
Not much to say about this; does what it says on the tin. However, formerly, if there was a column list then the ANALYZE action was implied; now it must be specified, or you get an error. This is because it would otherwise be a bit unclear what the user meant if some tables have column lists and some don't. Nathan Bossart, reviewed by Michael Paquier and Masahiko Sawada, with some editorialization by me Discussion: https://postgr.es/m/E061A8E3-5E3D-494D-94F0-E8A9B312BBFC@amazon.com
1 parent 45f9d08 commit 11d8d72

File tree

14 files changed

+329
-159
lines changed

14 files changed

+329
-159
lines changed

doc/src/sgml/ref/analyze.sgml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,11 @@ PostgreSQL documentation
2121

2222
<refsynopsisdiv>
2323
<synopsis>
24-
ANALYZE [ VERBOSE ] [ <replaceable class="PARAMETER">table_name</replaceable> [ ( <replaceable class="PARAMETER">column_name</replaceable> [, ...] ) ] ]
24+
ANALYZE [ VERBOSE ] [ <replaceable class="PARAMETER">table_and_columns</replaceable> [, ...] ]
25+
26+
<phrase>where <replaceable class="PARAMETER">table_and_columns</replaceable> is:</phrase>
27+
28+
<replaceable class="PARAMETER">table_name</replaceable> [ ( <replaceable class="PARAMETER">column_name</replaceable> [, ...] ) ]
2529
</synopsis>
2630
</refsynopsisdiv>
2731

@@ -38,9 +42,11 @@ ANALYZE [ VERBOSE ] [ <replaceable class="PARAMETER">table_name</replaceable> [
3842
</para>
3943

4044
<para>
41-
With no parameter, <command>ANALYZE</command> examines every table in the
42-
current database. With a parameter, <command>ANALYZE</command> examines
43-
only that table. It is further possible to give a list of column names,
45+
Without a <replaceable class="PARAMETER">table_and_columns</replaceable>
46+
list, <command>ANALYZE</command> processes every table and materialized view
47+
in the current database that the current user has permission to analyze.
48+
With a list, <command>ANALYZE</command> processes only those table(s).
49+
It is further possible to give a list of column names for a table,
4450
in which case only the statistics for those columns are collected.
4551
</para>
4652
</refsect1>

doc/src/sgml/ref/vacuum.sgml

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,20 @@ PostgreSQL documentation
2121

2222
<refsynopsisdiv>
2323
<synopsis>
24-
VACUUM [ ( { FULL | FREEZE | VERBOSE | ANALYZE | DISABLE_PAGE_SKIPPING } [, ...] ) ] [ <replaceable class="PARAMETER">table_name</replaceable> [ (<replaceable class="PARAMETER">column_name</replaceable> [, ...] ) ] ]
25-
VACUUM [ FULL ] [ FREEZE ] [ VERBOSE ] [ <replaceable class="PARAMETER">table_name</replaceable> ]
26-
VACUUM [ FULL ] [ FREEZE ] [ VERBOSE ] ANALYZE [ <replaceable class="PARAMETER">table_name</replaceable> [ (<replaceable class="PARAMETER">column_name</replaceable> [, ...] ) ] ]
24+
VACUUM [ ( <replaceable class="PARAMETER">option</replaceable> [, ...] ) ] [ <replaceable class="PARAMETER">table_and_columns</replaceable> [, ...] ]
25+
VACUUM [ FULL ] [ FREEZE ] [ VERBOSE ] [ ANALYZE ] [ <replaceable class="PARAMETER">table_and_columns</replaceable> [, ...] ]
26+
27+
<phrase>where <replaceable class="PARAMETER">option</replaceable> can be one of:</phrase>
28+
29+
FULL
30+
FREEZE
31+
VERBOSE
32+
ANALYZE
33+
DISABLE_PAGE_SKIPPING
34+
35+
<phrase>and <replaceable class="PARAMETER">table_and_columns</replaceable> is:</phrase>
36+
37+
<replaceable class="PARAMETER">table_name</replaceable> [ ( <replaceable class="PARAMETER">column_name</replaceable> [, ...] ) ]
2738
</synopsis>
2839
</refsynopsisdiv>
2940

@@ -40,9 +51,10 @@ VACUUM [ FULL ] [ FREEZE ] [ VERBOSE ] ANALYZE [ <replaceable class="PARAMETER">
4051
</para>
4152

4253
<para>
43-
With no parameter, <command>VACUUM</command> processes every table in the
44-
current database that the current user has permission to vacuum.
45-
With a parameter, <command>VACUUM</command> processes only that table.
54+
Without a <replaceable class="PARAMETER">table_and_columns</replaceable>
55+
list, <command>VACUUM</command> processes every table and materialized view
56+
in the current database that the current user has permission to vacuum.
57+
With a list, <command>VACUUM</command> processes only those table(s).
4658
</para>
4759

4860
<para>
@@ -141,8 +153,8 @@ VACUUM [ FULL ] [ FREEZE ] [ VERBOSE ] ANALYZE [ <replaceable class="PARAMETER">
141153
except when performing an aggressive vacuum, some pages may be skipped
142154
in order to avoid waiting for other sessions to finish using them.
143155
This option disables all page-skipping behavior, and is intended to
144-
be used only the contents of the visibility map are thought to
145-
be suspect, which should happen only if there is a hardware or software
156+
be used only when the contents of the visibility map are
157+
suspect, which should happen only if there is a hardware or software
146158
issue causing database corruption.
147159
</para>
148160
</listitem>
@@ -152,9 +164,8 @@ VACUUM [ FULL ] [ FREEZE ] [ VERBOSE ] ANALYZE [ <replaceable class="PARAMETER">
152164
<term><replaceable class="PARAMETER">table_name</replaceable></term>
153165
<listitem>
154166
<para>
155-
The name (optionally schema-qualified) of a specific table to
156-
vacuum. If omitted, all regular tables and materialized views in the
157-
current database are vacuumed. If the specified table is a partitioned
167+
The name (optionally schema-qualified) of a specific table or
168+
materialized view to vacuum. If the specified table is a partitioned
158169
table, all of its leaf partitions are vacuumed.
159170
</para>
160171
</listitem>
@@ -165,7 +176,8 @@ VACUUM [ FULL ] [ FREEZE ] [ VERBOSE ] ANALYZE [ <replaceable class="PARAMETER">
165176
<listitem>
166177
<para>
167178
The name of a specific column to analyze. Defaults to all columns.
168-
If a column list is specified, <literal>ANALYZE</> is implied.
179+
If a column list is specified, <literal>ANALYZE</> must also be
180+
specified.
169181
</para>
170182
</listitem>
171183
</varlistentry>

0 commit comments

Comments
 (0)