Book Image

PostgreSQL 9 High Availability Cookbook

By : Shaun Thomas
Book Image

PostgreSQL 9 High Availability Cookbook

By: Shaun Thomas

Overview of this book

Table of Contents (17 chapters)
PostgreSQL 9 High Availability Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Logging checkpoints properly


Checkpoints are an integral part of a PostgreSQL server. Table data is not modified during query execution until modified rows, index pages, and other structures are committed to the Write Ahead Log (WAL). WAL files are also known as checkpoint segments. When the count of these segments reaches checkpoint_segments—or the time since the last checkpoint exceeds checkpoint_timeout—the data files are modified to reflect the changes.

This decoupled writing ensures database integrity at the cost of doubling the necessary disk writes. This is the main reason why experienced PostgreSQL DBAs interested in performance move the WAL location to a separate storage device. However, even moving the WAL files to another device may not sufficiently reduce write pressure. Database activity is variable in nature, and checkpoints only happen every few minutes or after a threshold of data modifications.

As PostgreSQL tries to avoid overwhelming the operating system, writes necessary...