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

Commit f307fe4

Browse files
committed
Update documentation to emphasize autovacuum rather than
administrator-scheduled vacuums.
1 parent 3e805fd commit f307fe4

File tree

1 file changed

+33
-44
lines changed

1 file changed

+33
-44
lines changed

doc/src/sgml/maintenance.sgml

Lines changed: 33 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $PostgreSQL: pgsql/doc/src/sgml/maintenance.sgml,v 1.78 2007/08/19 01:41:24 adunstan Exp $ -->
1+
<!-- $PostgreSQL: pgsql/doc/src/sgml/maintenance.sgml,v 1.79 2007/09/13 23:43:35 momjian Exp $ -->
22

33
<chapter id="maintenance">
44
<title>Routine Database Maintenance Tasks</title>
@@ -59,8 +59,9 @@
5959
</indexterm>
6060

6161
<para>
62-
<productname>PostgreSQL</productname>'s <command>VACUUM</> command
63-
<emphasis>must</emphasis> be run on a regular basis for several reasons:
62+
<productname>PostgreSQL</productname>'s <command>VACUUM</> (<xref
63+
linkend="sql-vacuum"> command has to run on a regular basis for several
64+
reasons:
6465

6566
<orderedlist>
6667
<listitem>
@@ -78,14 +79,6 @@
7879
<firstterm>transaction ID wraparound</>.</simpara>
7980
</listitem>
8081
</orderedlist>
81-
82-
The frequency and scope of the <command>VACUUM</> operations
83-
performed for each of these reasons will vary depending on the
84-
needs of each site. Therefore, database administrators must
85-
understand these issues and develop an appropriate maintenance
86-
strategy. This section concentrates on explaining the high-level
87-
issues; for details about command syntax and so on, see the <xref
88-
linkend="sql-vacuum" endterm="sql-vacuum-title"> reference page.
8982
</para>
9083

9184
<para>
@@ -103,13 +96,14 @@
10396
</para>
10497

10598
<para>
106-
An automated mechanism for performing the necessary <command>VACUUM</>
107-
operations has been added in <productname>PostgreSQL</productname> 8.1.
108-
See <xref linkend="autovacuum">.
99+
Fortunately, autovacuum (<xref linkend="autovacuum">) monitors table
100+
activity and performs <command>VACUUM</command>s when necessary.
101+
Autovacuum works dynamically so it is often better
102+
administration-scheduled vacuuming.
109103
</para>
110104

111105
<sect2 id="vacuum-for-space-recovery">
112-
<title>Recovering disk space</title>
106+
<title>Recovering Disk Space</title>
113107

114108
<indexterm zone="vacuum-for-space-recovery">
115109
<primary>disk space</primary>
@@ -128,17 +122,6 @@
128122
space requirements. This is done by running <command>VACUUM</>.
129123
</para>
130124

131-
<para>
132-
Clearly, a table that receives frequent updates or deletes will need
133-
to be vacuumed more often than tables that are seldom updated. It
134-
might be useful to set up periodic <application>cron</> tasks that
135-
<command>VACUUM</command> only selected tables, skipping tables that are known not to
136-
change often. This is only likely to be helpful if you have both
137-
large heavily-updated tables and large seldom-updated tables &mdash; the
138-
extra cost of vacuuming a small table isn't enough to be worth
139-
worrying about.
140-
</para>
141-
142125
<para>
143126
There are two variants of the <command>VACUUM</command>
144127
command. The first form, known as <quote>lazy vacuum</quote> or
@@ -167,30 +150,36 @@
167150
</para>
168151

169152
<para>
170-
The standard form of <command>VACUUM</> is best used with the goal
171-
of maintaining a fairly level steady-state usage of disk space. If
172-
you need to return disk space to the operating system, you can use
173-
<command>VACUUM FULL</> &mdash; but what's the point of releasing disk
174-
space that will only have to be allocated again soon? Moderately
175-
frequent standard <command>VACUUM</> runs are a better approach
176-
than infrequent <command>VACUUM FULL</> runs for maintaining
177-
heavily-updated tables. However, if some heavily-updated tables
178-
have gone too long with infrequent <command>VACUUM</>, you can
153+
Fortunately, autovacuum (<xref linkend="autovacuum">) monitors table
154+
activity and performs <command>VACUUM</command>s when necessary. This
155+
eliminates the need for administrators to worry about disk space
156+
recovery in all but the most unusual cases.
157+
</para>
158+
159+
<para>
160+
For administrators who want to control <command>VACUUM</command>
161+
themselves, the standard form of <command>VACUUM</> is best used to
162+
maintain a steady-state usage of disk space. If you need to return
163+
disk space to the operating system, you can use <command>VACUUM
164+
FULL</>, but this is unwise if the table will just grow again in the
165+
future. Moderately-frequent standard <command>VACUUM</> runs are a
166+
better approach than infrequent <command>VACUUM FULL</> runs for
167+
maintaining heavily-updated tables. However, if some heavily-updated
168+
tables have gone too long with infrequent <command>VACUUM</>, you can
179169
use <command>VACUUM FULL</> or <command>CLUSTER</> to get performance
180170
back (it is much slower to scan a table containing almost only dead
181171
rows).
182172
</para>
183173

184174
<para>
185-
Recommended practice for most sites is to schedule a database-wide
186-
<command>VACUUM</> once a day at a low-usage time of day,
187-
supplemented by more frequent vacuuming of heavily-updated tables
188-
if necessary. (Some installations with extremely high update rates
189-
vacuum their busiest tables as often as once every few minutes.)
190-
If you have multiple databases
191-
in a cluster, don't forget to <command>VACUUM</command> each one;
192-
the program <xref linkend="app-vacuumdb" endterm="app-vacuumdb-title">
193-
might be helpful.
175+
For those not using autovacuum, one approach is to schedule a
176+
database-wide <command>VACUUM</> once a day during low-usage period,
177+
supplemented by more frequent vacuuming of heavily-updated tables if
178+
necessary. (Some installations with extremely high update rates vacuum
179+
their busiest tables as often as once every few minutes.) If you have
180+
multiple databases in a cluster, don't forget to
181+
<command>VACUUM</command> each one; the program <xref
182+
linkend="app-vacuumdb" endterm="app-vacuumdb-title"> might be helpful.
194183
</para>
195184

196185
<para>

0 commit comments

Comments
 (0)