Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
f307fe4c
Commit
f307fe4c
authored
Sep 13, 2007
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update documentation to emphasize autovacuum rather than
administrator-scheduled vacuums.
parent
3e805fdc
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
44 deletions
+33
-44
doc/src/sgml/maintenance.sgml
doc/src/sgml/maintenance.sgml
+33
-44
No files found.
doc/src/sgml/maintenance.sgml
View file @
f307fe4c
<!-- $PostgreSQL: pgsql/doc/src/sgml/maintenance.sgml,v 1.7
8 2007/08/19 01:41:24 adunst
an Exp $ -->
<!-- $PostgreSQL: pgsql/doc/src/sgml/maintenance.sgml,v 1.7
9 2007/09/13 23:43:35 momji
an Exp $ -->
<chapter id="maintenance">
<chapter id="maintenance">
<title>Routine Database Maintenance Tasks</title>
<title>Routine Database Maintenance Tasks</title>
...
@@ -59,8 +59,9 @@
...
@@ -59,8 +59,9 @@
</indexterm>
</indexterm>
<para>
<para>
<productname>PostgreSQL</productname>'s <command>VACUUM</> command
<productname>PostgreSQL</productname>'s <command>VACUUM</> (<xref
<emphasis>must</emphasis> be run on a regular basis for several reasons:
linkend="sql-vacuum"> command has to run on a regular basis for several
reasons:
<orderedlist>
<orderedlist>
<listitem>
<listitem>
...
@@ -78,14 +79,6 @@
...
@@ -78,14 +79,6 @@
<firstterm>transaction ID wraparound</>.</simpara>
<firstterm>transaction ID wraparound</>.</simpara>
</listitem>
</listitem>
</orderedlist>
</orderedlist>
The frequency and scope of the <command>VACUUM</> operations
performed for each of these reasons will vary depending on the
needs of each site. Therefore, database administrators must
understand these issues and develop an appropriate maintenance
strategy. This section concentrates on explaining the high-level
issues; for details about command syntax and so on, see the <xref
linkend="sql-vacuum" endterm="sql-vacuum-title"> reference page.
</para>
</para>
<para>
<para>
...
@@ -103,13 +96,14 @@
...
@@ -103,13 +96,14 @@
</para>
</para>
<para>
<para>
An automated mechanism for performing the necessary <command>VACUUM</>
Fortunately, autovacuum (<xref linkend="autovacuum">) monitors table
operations has been added in <productname>PostgreSQL</productname> 8.1.
activity and performs <command>VACUUM</command>s when necessary.
See <xref linkend="autovacuum">.
Autovacuum works dynamically so it is often better
administration-scheduled vacuuming.
</para>
</para>
<sect2 id="vacuum-for-space-recovery">
<sect2 id="vacuum-for-space-recovery">
<title>Recovering
disk s
pace</title>
<title>Recovering
Disk S
pace</title>
<indexterm zone="vacuum-for-space-recovery">
<indexterm zone="vacuum-for-space-recovery">
<primary>disk space</primary>
<primary>disk space</primary>
...
@@ -128,17 +122,6 @@
...
@@ -128,17 +122,6 @@
space requirements. This is done by running <command>VACUUM</>.
space requirements. This is done by running <command>VACUUM</>.
</para>
</para>
<para>
Clearly, a table that receives frequent updates or deletes will need
to be vacuumed more often than tables that are seldom updated. It
might be useful to set up periodic <application>cron</> tasks that
<command>VACUUM</command> only selected tables, skipping tables that are known not to
change often. This is only likely to be helpful if you have both
large heavily-updated tables and large seldom-updated tables — the
extra cost of vacuuming a small table isn't enough to be worth
worrying about.
</para>
<para>
<para>
There are two variants of the <command>VACUUM</command>
There are two variants of the <command>VACUUM</command>
command. The first form, known as <quote>lazy vacuum</quote> or
command. The first form, known as <quote>lazy vacuum</quote> or
...
@@ -167,30 +150,36 @@
...
@@ -167,30 +150,36 @@
</para>
</para>
<para>
<para>
The standard form of <command>VACUUM</> is best used with the goal
Fortunately, autovacuum (<xref linkend="autovacuum">) monitors table
of maintaining a fairly level steady-state usage of disk space. If
activity and performs <command>VACUUM</command>s when necessary. This
you need to return disk space to the operating system, you can use
eliminates the need for administrators to worry about disk space
<command>VACUUM FULL</> — but what's the point of releasing disk
recovery in all but the most unusual cases.
space that will only have to be allocated again soon? Moderately
</para>
frequent standard <command>VACUUM</> runs are a better approach
than infrequent <command>VACUUM FULL</> runs for maintaining
<para>
heavily-updated tables. However, if some heavily-updated tables
For administrators who want to control <command>VACUUM</command>
have gone too long with infrequent <command>VACUUM</>, you can
themselves, the standard form of <command>VACUUM</> is best used to
maintain a steady-state usage of disk space. If you need to return
disk space to the operating system, you can use <command>VACUUM
FULL</>, but this is unwise if the table will just grow again in the
future. Moderately-frequent standard <command>VACUUM</> runs are a
better approach than infrequent <command>VACUUM FULL</> runs for
maintaining heavily-updated tables. However, if some heavily-updated
tables have gone too long with infrequent <command>VACUUM</>, you can
use <command>VACUUM FULL</> or <command>CLUSTER</> to get performance
use <command>VACUUM FULL</> or <command>CLUSTER</> to get performance
back (it is much slower to scan a table containing almost only dead
back (it is much slower to scan a table containing almost only dead
rows).
rows).
</para>
</para>
<para>
<para>
Recommended practice for most sites is to schedule a database-wide
For those not using autovacuum, one approach is to schedule a
<command>VACUUM</> once a day at a low-usage time of day,
database-wide <command>VACUUM</> once a day during low-usage period,
supplemented by more frequent vacuuming of heavily-updated tables
supplemented by more frequent vacuuming of heavily-updated tables if
if necessary. (Some installations with extremely high update rates
necessary. (Some installations with extremely high update rates vacuum
vacuum their busiest tables as often as once every few minutes.)
their busiest tables as often as once every few minutes.) If you have
If you have multiple databases
multiple databases in a cluster, don't forget to
in a cluster, don't forget to <command>VACUUM</command> each one;
<command>VACUUM</command> each one; the program <xref
the program <xref linkend="app-vacuumdb" endterm="app-vacuumdb-title">
linkend="app-vacuumdb" endterm="app-vacuumdb-title"> might be helpful.
might be helpful.
</para>
</para>
<para>
<para>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment