Book Image

PostgreSQL 9 Administration Cookbook - Second Edition

Book Image

PostgreSQL 9 Administration Cookbook - Second Edition

Overview of this book

Table of Contents (19 chapters)
PostgreSQL 9 Administration Cookbook Second Edition
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Incremental/differential backup and restore


If you have performance problems with backup of a large PostgreSQL database, then you may consider incremental or differential backup.

An incremental backup is a backup of all files that have changed since the last full backup. In order to perform a restore, you must restore the full backup and then each set of incremental changes.

A differential backup is a backup of all individual changes since the last full backup. Again, restore requires you to restore the full backup and then apply any changes since then.

How to do it…

To perform a differential physical backup, you can use rsync to compare the existing files against the previous full backup, and then overwrite only the changed data blocks. It's a bad plan to overwrite your last backup because if the new backup fails, you are left without backups. Therefore, keep two or more copies. An example backup schedule can be as follows:

Day of the week

Backup set 1

Backup set 2

Sunday

New full backup...