diff options
Diffstat (limited to 'doc/src/sgml')
-rw-r--r-- | doc/src/sgml/ddl.sgml | 23 | ||||
-rw-r--r-- | doc/src/sgml/monitoring.sgml | 6 | ||||
-rw-r--r-- | doc/src/sgml/ref/analyze.sgml | 36 | ||||
-rw-r--r-- | doc/src/sgml/ref/vacuum.sgml | 11 |
4 files changed, 44 insertions, 32 deletions
diff --git a/doc/src/sgml/ddl.sgml b/doc/src/sgml/ddl.sgml index b671858627b..8ab0ddb112f 100644 --- a/doc/src/sgml/ddl.sgml +++ b/doc/src/sgml/ddl.sgml @@ -3778,12 +3778,14 @@ VALUES ('Albany', NULL, NULL, 'NY'); not <literal>INSERT</literal> or <literal>ALTER TABLE ... RENAME</literal>) typically default to including child tables and support the <literal>ONLY</literal> notation to exclude them. - Commands that do database maintenance and tuning - (e.g., <literal>REINDEX</literal>, <literal>VACUUM</literal>) - typically only work on individual, physical tables and do not - support recursing over inheritance hierarchies. The respective - behavior of each individual command is documented in its reference - page (<xref linkend="sql-commands"/>). + The majority of commands that do database maintenance and tuning + (e.g., <literal>REINDEX</literal>) only work on individual, physical + tables and do not support recursing over inheritance hierarchies. + However, both <literal>VACUUM</literal> and <literal>ANALYZE</literal> + commands default to including child tables and the <literal>ONLY</literal> + notation is supported to allow them to be excluded. The respective + behavior of each individual command is documented in its reference page + (<xref linkend="sql-commands"/>). </para> <para> @@ -4854,11 +4856,12 @@ ALTER TABLE measurement_y2008m02 INHERIT measurement; <listitem> <para> - If you are using manual <command>VACUUM</command> or - <command>ANALYZE</command> commands, don't forget that - you need to run them on each child table individually. A command like: + Manual <command>VACUUM</command> and <command>ANALYZE</command> + commands will automatically process all inheritance child tables. If + this is undesirable, you can use the <literal>ONLY</literal> keyword. + A command like: <programlisting> -ANALYZE measurement; +ANALYZE ONLY measurement; </programlisting> will only process the root table. </para> diff --git a/doc/src/sgml/monitoring.sgml b/doc/src/sgml/monitoring.sgml index a2fda4677d7..db7f35a4515 100644 --- a/doc/src/sgml/monitoring.sgml +++ b/doc/src/sgml/monitoring.sgml @@ -5525,9 +5525,9 @@ FROM pg_stat_get_backend_idset() AS backendid; <note> <para> - Note that when <command>ANALYZE</command> is run on a partitioned table, - all of its partitions are also recursively analyzed. - In that case, <command>ANALYZE</command> + Note that when <command>ANALYZE</command> is run on a partitioned table + without the <literal>ONLY</literal> keyword, all of its partitions are + also recursively analyzed. In that case, <command>ANALYZE</command> progress is reported first for the parent table, whereby its inheritance statistics are collected, followed by that for each partition. </para> diff --git a/doc/src/sgml/ref/analyze.sgml b/doc/src/sgml/ref/analyze.sgml index 2b94b378e9f..a0db56ae743 100644 --- a/doc/src/sgml/ref/analyze.sgml +++ b/doc/src/sgml/ref/analyze.sgml @@ -31,7 +31,7 @@ ANALYZE [ ( <replaceable class="parameter">option</replaceable> [, ...] ) ] [ <r <phrase>and <replaceable class="parameter">table_and_columns</replaceable> is:</phrase> - <replaceable class="parameter">table_name</replaceable> [ ( <replaceable class="parameter">column_name</replaceable> [, ...] ) ] + [ ONLY ] <replaceable class="parameter">table_name</replaceable> [ * ] [ ( <replaceable class="parameter">column_name</replaceable> [, ...] ) ] </synopsis> </refsynopsisdiv> @@ -142,9 +142,12 @@ ANALYZE [ ( <replaceable class="parameter">option</replaceable> [, ...] ) ] [ <r The name (possibly schema-qualified) of a specific table to analyze. If omitted, all regular tables, partitioned tables, and materialized views in the current database are analyzed (but not - foreign tables). If the specified table is a partitioned table, both the - inheritance statistics of the partitioned table as a whole and - statistics of the individual partitions are updated. + foreign tables). If <literal>ONLY</literal> is specified before + the table name, only that table is analyzed. If <literal>ONLY</literal> + is not specified, the table and all its inheritance child tables or + partitions (if any) are analyzed. Optionally, <literal>*</literal> + can be specified after the table name to explicitly indicate that + inheritance child tables (or partitions) are to be analyzed. </para> </listitem> </varlistentry> @@ -284,22 +287,23 @@ ANALYZE [ ( <replaceable class="parameter">option</replaceable> [, ...] ) ] [ <r <command>ANALYZE</command> gathers two sets of statistics: one on the rows of the parent table only, and a second including rows of both the parent table and all of its children. This second set of statistics is needed when - planning queries that process the inheritance tree as a whole. The child - tables themselves are not individually analyzed in this case. - The autovacuum daemon, however, will only consider inserts or - updates on the parent table itself when deciding whether to trigger an - automatic analyze for that table. If that table is rarely inserted into - or updated, the inheritance statistics will not be up to date unless you - run <command>ANALYZE</command> manually. + planning queries that process the inheritance tree as a whole. The + autovacuum daemon, however, will only consider inserts or updates on the + parent table itself when deciding whether to trigger an automatic analyze + for that table. If that table is rarely inserted into or updated, the + inheritance statistics will not be up to date unless you run + <command>ANALYZE</command> manually. By default, + <command>ANALYZE</command> will also recursively collect and update the + statistics for each inheritance child table. The <literal>ONLY</literal> + keyword may be used to disable this. </para> <para> For partitioned tables, <command>ANALYZE</command> gathers statistics by - sampling rows from all partitions; in addition, it will recurse into each - partition and update its statistics. Each leaf partition is analyzed only - once, even with multi-level partitioning. No statistics are collected for - only the parent table (without data from its partitions), because with - partitioning it's guaranteed to be empty. + sampling rows from all partitions. By default, + <command>ANALYZE</command> will also recursively collect and update the + statistics for each partition. The <literal>ONLY</literal> keyword may be + used to disable this. </para> <para> diff --git a/doc/src/sgml/ref/vacuum.sgml b/doc/src/sgml/ref/vacuum.sgml index 9857b35627b..9110938fab6 100644 --- a/doc/src/sgml/ref/vacuum.sgml +++ b/doc/src/sgml/ref/vacuum.sgml @@ -42,7 +42,7 @@ VACUUM [ ( <replaceable class="parameter">option</replaceable> [, ...] ) ] [ <re <phrase>and <replaceable class="parameter">table_and_columns</replaceable> is:</phrase> - <replaceable class="parameter">table_name</replaceable> [ ( <replaceable class="parameter">column_name</replaceable> [, ...] ) ] + [ ONLY ] <replaceable class="parameter">table_name</replaceable> [ * ] [ ( <replaceable class="parameter">column_name</replaceable> [, ...] ) ] </synopsis> </refsynopsisdiv> @@ -401,8 +401,13 @@ VACUUM [ ( <replaceable class="parameter">option</replaceable> [, ...] ) ] [ <re <listitem> <para> The name (optionally schema-qualified) of a specific table or - materialized view to vacuum. If the specified table is a partitioned - table, all of its leaf partitions are vacuumed. + materialized view to vacuum. If <literal>ONLY</literal> is specified + before the table name, only that table is vacuumed. If + <literal>ONLY</literal> is not specified, the table and all its + inheritance child tables or partitions (if any) are also vacuumed. + Optionally, <literal>*</literal> can be specified after the table name + to explicitly indicate that inheritance child tables (or partitions) are + to be vacuumed. </para> </listitem> </varlistentry> |