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

Delaying, pausing, and synchronizing replication


Some advanced features and thoughts for replication are covered here.

Getting ready

If you have multiple standby servers, you may want to have one or more servers operating in a delayed apply state, for example, 1 hour behind the master. This can be useful to help recover from user errors such as mistaken transactions or dropped tables.

How to do it…

Normally, a standby will apply changes as soon as possible. When you set the recovery_min_apply_delay parameter in recovery.conf, the application of commit records will be delayed by the specified duration. Note that only commit records are delayed, so you may receive Hot Standby cancellations using this feature. You can prevent that by setting hot_standby_feedback to on, but use this with caution, since it can cause significant bloat on a busy master if recovery_min_apply_delay is large.

If something bad happens, then hit the pause button.

Hot Standby allows you to pause and resume replay of changes...