Chapter 24. Backup and Restore

Table of Contents
24.1. SQL Dump
24.1.1. Restoring the dump
24.1.2. Using pg_dumpall
24.1.3. Handling large databases
24.2. File System Level Backup
24.3. Continuous Archiving and Point-In-Time Recovery (PITR)
24.3.1. Setting up WAL archiving
24.3.2. Making a Base Backup
24.3.3. Recovering using a Continuous Archive Backup
24.3.4. Timelines
24.3.5. Tips and Examples
24.3.6. Caveats
24.4. Warm Standby Servers for High Availability
24.4.1. Planning
24.4.2. Implementation
24.4.3. Failover
24.4.4. Record-based Log Shipping
24.5. Migration Between Releases

As with everything that contains valuable data, PostgreSQL databases should be backed up regularly. While the procedure is essentially simple, it is important to have a clear understanding of the underlying techniques and assumptions.

There are three fundamentally different approaches to backing up PostgreSQL data:

Each has its own strengths and weaknesses. Each is discussed in turn below.