Chapter 23. Backup and Restore

Table of Contents
23.1. SQL Dump
23.1.1. Restoring the Dump
23.1.2. Using pg_dumpall
23.1.3. Handling Large Databases
23.2. File System Level Backup
23.3. Continuous Archiving and Point-in-Time Recovery (PITR)
23.3.1. Setting Up WAL Archiving
23.3.2. Making a Base Backup
23.3.3. Recovering Using a Continuous Archive Backup
23.3.4. Timelines
23.3.5. Tips and Examples
23.3.6. Caveats

Note: The following description applies both to Postgres-XC and PostgreSQL if not described explicitly. You can read PostgreSQL as Postgres-XC except for version number, which is specific to each product.

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 in the following sections.