blob: 077f87cc600493ee61e4a920d1391ece7574020a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 24. Routine Database Maintenance Tasks</title><link rel="stylesheet" type="text/css" href="stylesheet.css" /><link rev="made" href="pgsql-docs@lists.postgresql.org" /><meta name="generator" content="DocBook XSL Stylesheets V1.79.1" /><link rel="prev" href="multibyte.html" title="23.3. Character Set Support" /><link rel="next" href="routine-vacuuming.html" title="24.1. Routine Vacuuming" /></head><body id="docContent" class="container-fluid col-10"><div xmlns="http://www.w3.org/TR/xhtml1/transitional" class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center">Chapter 24. Routine Database Maintenance Tasks</th></tr><tr><td width="10%" align="left"><a accesskey="p" href="multibyte.html" title="23.3. Character Set Support">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="admin.html" title="Part III. Server Administration">Up</a></td><th width="60%" align="center">Part III. Server Administration</th><td width="10%" align="right"><a accesskey="h" href="index.html" title="PostgreSQL 13.4 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="routine-vacuuming.html" title="24.1. Routine Vacuuming">Next</a></td></tr></table><hr></hr></div><div class="chapter" id="MAINTENANCE"><div class="titlepage"><div><div><h2 class="title">Chapter 24. Routine Database Maintenance Tasks</h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="sect1"><a href="routine-vacuuming.html">24.1. Routine Vacuuming</a></span></dt><dd><dl><dt><span class="sect2"><a href="routine-vacuuming.html#VACUUM-BASICS">24.1.1. Vacuuming Basics</a></span></dt><dt><span class="sect2"><a href="routine-vacuuming.html#VACUUM-FOR-SPACE-RECOVERY">24.1.2. Recovering Disk Space</a></span></dt><dt><span class="sect2"><a href="routine-vacuuming.html#VACUUM-FOR-STATISTICS">24.1.3. Updating Planner Statistics</a></span></dt><dt><span class="sect2"><a href="routine-vacuuming.html#VACUUM-FOR-VISIBILITY-MAP">24.1.4. Updating the Visibility Map</a></span></dt><dt><span class="sect2"><a href="routine-vacuuming.html#VACUUM-FOR-WRAPAROUND">24.1.5. Preventing Transaction ID Wraparound Failures</a></span></dt><dt><span class="sect2"><a href="routine-vacuuming.html#AUTOVACUUM">24.1.6. The Autovacuum Daemon</a></span></dt></dl></dd><dt><span class="sect1"><a href="routine-reindex.html">24.2. Routine Reindexing</a></span></dt><dt><span class="sect1"><a href="logfile-maintenance.html">24.3. Log File Maintenance</a></span></dt></dl></div><a id="id-1.6.11.2" class="indexterm"></a><a id="id-1.6.11.3" class="indexterm"></a><p>
<span class="productname">PostgreSQL</span>, like any database software, requires that certain tasks
be performed regularly to achieve optimum performance. The tasks
discussed here are <span class="emphasis"><em>required</em></span>, but they
are repetitive in nature and can easily be automated using standard
tools such as <span class="application">cron</span> scripts or
Windows' <span class="application">Task Scheduler</span>. It is the database
administrator's responsibility to set up appropriate scripts, and to
check that they execute successfully.
</p><p>
One obvious maintenance task is the creation of backup copies of the data on a
regular schedule. Without a recent backup, you have no chance of recovery
after a catastrophe (disk failure, fire, mistakenly dropping a critical
table, etc.). The backup and recovery mechanisms available in
<span class="productname">PostgreSQL</span> are discussed at length in
<a class="xref" href="backup.html" title="Chapter 25. Backup and Restore">Chapter 25</a>.
</p><p>
The other main category of maintenance task is periodic <span class="quote">“<span class="quote">vacuuming</span>”</span>
of the database. This activity is discussed in
<a class="xref" href="routine-vacuuming.html" title="24.1. Routine Vacuuming">Section 24.1</a>. Closely related to this is updating
the statistics that will be used by the query planner, as discussed in
<a class="xref" href="routine-vacuuming.html#VACUUM-FOR-STATISTICS" title="24.1.3. Updating Planner Statistics">Section 24.1.3</a>.
</p><p>
Another task that might need periodic attention is log file management.
This is discussed in <a class="xref" href="logfile-maintenance.html" title="24.3. Log File Maintenance">Section 24.3</a>.
</p><p>
<a class="ulink" href="https://bucardo.org/check_postgres/" target="_top"><span class="application">check_postgres</span></a>
is available for monitoring database health and reporting unusual
conditions. <span class="application">check_postgres</span> integrates with
Nagios and MRTG, but can be run standalone too.
</p><p>
<span class="productname">PostgreSQL</span> is low-maintenance compared
to some other database management systems. Nonetheless,
appropriate attention to these tasks will go far towards ensuring a
pleasant and productive experience with the system.
</p></div><div xmlns="http://www.w3.org/TR/xhtml1/transitional" class="navfooter"><hr></hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="multibyte.html" title="23.3. Character Set Support">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="admin.html" title="Part III. Server Administration">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="routine-vacuuming.html" title="24.1. Routine Vacuuming">Next</a></td></tr><tr><td width="40%" align="left" valign="top">23.3. Character Set Support </td><td width="20%" align="center"><a accesskey="h" href="index.html" title="PostgreSQL 13.4 Documentation">Home</a></td><td width="40%" align="right" valign="top"> 24.1. Routine Vacuuming</td></tr></table></div></body></html>
|