Book Image

PostgreSQL Replication, Second Edition

Book Image

PostgreSQL Replication, Second Edition

Overview of this book

Table of Contents (22 chapters)
PostgreSQL Replication Second Edition
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Tuning checkpoints and the XLOG


So far, this chapter has hopefully provided some insights into how PostgreSQL writes data and what the XLOG is used for in general. Given this knowledge, we can now move on and see what we can do to make our databases work even more efficiently, both in the case of replication and in the case of running just a single server.

Understanding the checkpoints

In this chapter, we have seen that data has to be written to the XLOG before it can go anywhere. The thing is that if the XLOG was never deleted, clearly, we would not write to it forever without filling up the disk at some point in time.

To solve this problem, the XLOG has to be deleted at some point. This process is called checkpointing.

The main question arising from this issue is, "When can the XLOG be truncated up to a certain point?" The answer is, "When PostgreSQL has put everything that is already in the XLOG into the storage files." If all the changes made to the XLOG are also made to the data files,...