]> begriffs open source - ai-pg/blob - full-docs/txt/maintenance.txt
Convert HTML docs to more streamlined TXT
[ai-pg] / full-docs / txt / maintenance.txt
1
2 Chapter 24. Routine Database Maintenance Tasks
3
4    Table of Contents
5
6    24.1. Routine Vacuuming
7
8         24.1.1. Vacuuming Basics
9         24.1.2. Recovering Disk Space
10         24.1.3. Updating Planner Statistics
11         24.1.4. Updating the Visibility Map
12         24.1.5. Preventing Transaction ID Wraparound Failures
13         24.1.6. The Autovacuum Daemon
14
15    24.2. Routine Reindexing
16    24.3. Log File Maintenance
17
18    PostgreSQL, like any database software, requires that certain tasks be
19    performed regularly to achieve optimum performance. The tasks discussed
20    here are required, but they are repetitive in nature and can easily be
21    automated using standard tools such as cron scripts or Windows' Task
22    Scheduler. It is the database administrator's responsibility to set up
23    appropriate scripts, and to check that they execute successfully.
24
25    One obvious maintenance task is the creation of backup copies of the
26    data on a regular schedule. Without a recent backup, you have no chance
27    of recovery after a catastrophe (disk failure, fire, mistakenly
28    dropping a critical table, etc.). The backup and recovery mechanisms
29    available in PostgreSQL are discussed at length in Chapter 25.
30
31    The other main category of maintenance task is periodic “vacuuming” of
32    the database. This activity is discussed in Section 24.1. Closely
33    related to this is updating the statistics that will be used by the
34    query planner, as discussed in Section 24.1.3.
35
36    Another task that might need periodic attention is log file management.
37    This is discussed in Section 24.3.
38
39    check_postgres is available for monitoring database health and
40    reporting unusual conditions. check_postgres integrates with Nagios and
41    MRTG, but can be run standalone too.
42
43    PostgreSQL is low-maintenance compared to some other database
44    management systems. Nonetheless, appropriate attention to these tasks
45    will go far towards ensuring a pleasant and productive experience with
46    the system.