Commit 2a997a70 authored by Alvaro Herrera's avatar Alvaro Herrera

A few improvements to analyze and vacuum sections in documentation: add "see

also" entries for autovacuum in analyze and vacuum reference pages, and
enhance usage of cross-references in the maintenance page.
parent a3ff9373
<!-- $PostgreSQL: pgsql/doc/src/sgml/maintenance.sgml,v 1.83 2007/10/06 17:45:49 alvherre Exp $ --> <!-- $PostgreSQL: pgsql/doc/src/sgml/maintenance.sgml,v 1.84 2007/10/07 01:16:42 alvherre Exp $ -->
<chapter id="maintenance"> <chapter id="maintenance">
<title>Routine Database Maintenance Tasks</title> <title>Routine Database Maintenance Tasks</title>
...@@ -59,9 +59,9 @@ ...@@ -59,9 +59,9 @@
</indexterm> </indexterm>
<para> <para>
<productname>PostgreSQL</productname>'s <command>VACUUM</> (<xref <productname>PostgreSQL</productname>'s
linkend="sql-vacuum">) command has to run on a regular basis for several <xref linkend="sql-vacuum" endterm="sql-vacuum-title"> command has to run on
reasons: a regular basis for several reasons:
<orderedlist> <orderedlist>
<listitem> <listitem>
...@@ -96,7 +96,8 @@ ...@@ -96,7 +96,8 @@
</para> </para>
<para> <para>
Fortunately, autovacuum (<xref linkend="autovacuum">) monitors table Fortunately, <xref linkend="autovacuum" endterm="autovacuum-title">
monitors table
activity and performs <command>VACUUM</command>s when necessary. activity and performs <command>VACUUM</command>s when necessary.
Autovacuum works dynamically so it is often better Autovacuum works dynamically so it is often better
administration-scheduled vacuuming. administration-scheduled vacuuming.
...@@ -150,7 +151,8 @@ ...@@ -150,7 +151,8 @@
</para> </para>
<para> <para>
Fortunately, autovacuum (<xref linkend="autovacuum">) monitors table Fortunately, <xref linkend="autovacuum" endterm="autovacuum-title">
monitors table
activity and performs <command>VACUUM</command>s when necessary. This activity and performs <command>VACUUM</command>s when necessary. This
eliminates the need for administrators to worry about disk space eliminates the need for administrators to worry about disk space
recovery in all but the most unusual cases. recovery in all but the most unusual cases.
...@@ -218,7 +220,8 @@ ...@@ -218,7 +220,8 @@
The <productname>PostgreSQL</productname> query planner relies on The <productname>PostgreSQL</productname> query planner relies on
statistical information about the contents of tables in order to statistical information about the contents of tables in order to
generate good plans for queries. These statistics are gathered by generate good plans for queries. These statistics are gathered by
the <command>ANALYZE</> command, which can be invoked by itself or the <xref linkend="sql-analyze" endterm="sql-analyze-title"> command,
which can be invoked by itself or
as an optional step in <command>VACUUM</>. It is important to have as an optional step in <command>VACUUM</>. It is important to have
reasonably accurate statistics, otherwise poor choices of plans might reasonably accurate statistics, otherwise poor choices of plans might
degrade database performance. degrade database performance.
...@@ -262,7 +265,8 @@ ...@@ -262,7 +265,8 @@
</tip> </tip>
<para> <para>
Fortunately, autovacuum (<xref linkend="autovacuum">) monitors table Fortunately, <xref linkend="autovacuum" endterm="autovacuum-title">
monitors table
activity and performs <command>ANALYZE</command>s when necessary. This activity and performs <command>ANALYZE</command>s when necessary. This
eliminates the need for administrators to manually schedule eliminates the need for administrators to manually schedule
<command>ANALYZE</command>. <command>ANALYZE</command>.
...@@ -341,8 +345,8 @@ ...@@ -341,8 +345,8 @@
when it was last vacuumed. when it was last vacuumed.
If it were to go unvacuumed for longer than that, If it were to go unvacuumed for longer than that,
data loss could result. To ensure that this does not data loss could result. To ensure that this does not
happen, the <firstterm>autovacuum</> facility described in happen, <xref linkend="autovacuum" endterm="autovacuum-title">
<xref linkend="autovacuum"> is invoked on any table is invoked on any table
that might contain XIDs older than the age specified by the that might contain XIDs older than the age specified by the
configuration parameter configuration parameter
<xref linkend="guc-autovacuum-freeze-max-age">. (This will happen <xref linkend="guc-autovacuum-freeze-max-age">. (This will happen
......
<!-- <!--
$PostgreSQL: pgsql/doc/src/sgml/ref/analyze.sgml,v 1.22 2007/05/15 19:13:55 neilc Exp $ $PostgreSQL: pgsql/doc/src/sgml/ref/analyze.sgml,v 1.23 2007/10/07 01:16:42 alvherre Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -92,7 +92,12 @@ ANALYZE [ VERBOSE ] [ <replaceable class="PARAMETER">table</replaceable> [ ( <re ...@@ -92,7 +92,12 @@ ANALYZE [ VERBOSE ] [ <replaceable class="PARAMETER">table</replaceable> [ ( <re
<title>Notes</title> <title>Notes</title>
<para> <para>
It is a good idea to run <command>ANALYZE</command> periodically, or In the default <productname>PostgreSQL</productname> configuration,
<xref linkend="autovacuum" endterm="autovacuum-title">
takes care of automatic analyzing of tables when they are first loaded
with data, and as they change throughout regular operation.
When autovacuum is disabled,
it is a good idea to run <command>ANALYZE</command> periodically, or
just after making major changes in the contents of a table. Accurate just after making major changes in the contents of a table. Accurate
statistics will help the planner to choose the most appropriate query statistics will help the planner to choose the most appropriate query
plan, and thereby improve the speed of query processing. A common plan, and thereby improve the speed of query processing. A common
...@@ -101,7 +106,7 @@ ANALYZE [ VERBOSE ] [ <replaceable class="PARAMETER">table</replaceable> [ ( <re ...@@ -101,7 +106,7 @@ ANALYZE [ VERBOSE ] [ <replaceable class="PARAMETER">table</replaceable> [ ( <re
</para> </para>
<para> <para>
Unlike <command>VACUUM FULL</command>, <command>ANALYZE</command> <command>ANALYZE</command>
requires only a read lock on the target table, so it can run in requires only a read lock on the target table, so it can run in
parallel with other activity on the table. parallel with other activity on the table.
</para> </para>
...@@ -168,4 +173,15 @@ ANALYZE [ VERBOSE ] [ <replaceable class="PARAMETER">table</replaceable> [ ( <re ...@@ -168,4 +173,15 @@ ANALYZE [ VERBOSE ] [ <replaceable class="PARAMETER">table</replaceable> [ ( <re
There is no <command>ANALYZE</command> statement in the SQL standard. There is no <command>ANALYZE</command> statement in the SQL standard.
</para> </para>
</refsect1> </refsect1>
<refsect1>
<title>See Also</title>
<simplelist type="inline">
<member><xref linkend="sql-vacuum" endterm="sql-vacuum-title"></member>
<member><xref linkend="app-vacuumdb" endterm="app-vacuumdb-title"></member>
<member><xref linkend="runtime-config-resource-vacuum-cost" endterm="runtime-config-resource-vacuum-cost-title"></member>
<member><xref linkend="autovacuum" endterm="autovacuum-title"></member>
</simplelist>
</refsect1>
</refentry> </refentry>
<!-- <!--
$PostgreSQL: pgsql/doc/src/sgml/ref/vacuum.sgml,v 1.48 2007/05/30 19:45:01 momjian Exp $ $PostgreSQL: pgsql/doc/src/sgml/ref/vacuum.sgml,v 1.49 2007/10/07 01:16:42 alvherre Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -242,6 +242,7 @@ VACUUM ...@@ -242,6 +242,7 @@ VACUUM
<simplelist type="inline"> <simplelist type="inline">
<member><xref linkend="app-vacuumdb" endterm="app-vacuumdb-title"></member> <member><xref linkend="app-vacuumdb" endterm="app-vacuumdb-title"></member>
<member><xref linkend="runtime-config-resource-vacuum-cost" endterm="runtime-config-resource-vacuum-cost-title"></member> <member><xref linkend="runtime-config-resource-vacuum-cost" endterm="runtime-config-resource-vacuum-cost-title"></member>
<member><xref linkend="autovacuum" endterm="autovacuum-title"></member>
</simplelist> </simplelist>
</refsect1> </refsect1>
</refentry> </refentry>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment