blob: 6bae20c9d2494509f0c2a42cd01ec804ab651853 (
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 25. 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 Vsnapshot" /><link rel="prev" href="multibyte.html" title="24.3. Character Set Support" /><link rel="next" href="routine-vacuuming.html" title="25.1. Routine Vacuuming" /></head><body id="docContent" class="container-fluid col-10"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center">Chapter 25. Routine Database Maintenance Tasks</th></tr><tr><td width="10%" align="left"><a accesskey="p" href="multibyte.html" title="24.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 16.2 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="routine-vacuuming.html" title="25.1. Routine Vacuuming">Next</a></td></tr></table><hr /></div><div class="chapter" id="MAINTENANCE"><div class="titlepage"><div><div><h2 class="title">Chapter 25. 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">25.1. Routine Vacuuming</a></span></dt><dd><dl><dt><span class="sect2"><a href="routine-vacuuming.html#VACUUM-BASICS">25.1.1. Vacuuming Basics</a></span></dt><dt><span class="sect2"><a href="routine-vacuuming.html#VACUUM-FOR-SPACE-RECOVERY">25.1.2. Recovering Disk Space</a></span></dt><dt><span class="sect2"><a href="routine-vacuuming.html#VACUUM-FOR-STATISTICS">25.1.3. Updating Planner Statistics</a></span></dt><dt><span class="sect2"><a href="routine-vacuuming.html#VACUUM-FOR-VISIBILITY-MAP">25.1.4. Updating the Visibility Map</a></span></dt><dt><span class="sect2"><a href="routine-vacuuming.html#VACUUM-FOR-WRAPAROUND">25.1.5. Preventing Transaction ID Wraparound Failures</a></span></dt><dt><span class="sect2"><a href="routine-vacuuming.html#AUTOVACUUM">25.1.6. The Autovacuum Daemon</a></span></dt></dl></dd><dt><span class="sect1"><a href="routine-reindex.html">25.2. Routine Reindexing</a></span></dt><dt><span class="sect1"><a href="logfile-maintenance.html">25.3. Log File Maintenance</a></span></dt></dl></div><a id="id-1.6.12.2" class="indexterm"></a><a id="id-1.6.12.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 26. Backup and Restore">Chapter 26</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="25.1. Routine Vacuuming">Section 25.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="25.1.3. Updating Planner Statistics">Section 25.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="25.3. Log File Maintenance">Section 25.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 class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="multibyte.html" title="24.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="25.1. Routine Vacuuming">Next</a></td></tr><tr><td width="40%" align="left" valign="top">24.3. Character Set Support </td><td width="20%" align="center"><a accesskey="h" href="index.html" title="PostgreSQL 16.2 Documentation">Home</a></td><td width="40%" align="right" valign="top"> 25.1. Routine Vacuuming</td></tr></table></div></body></html>
|