Chapter 9.  Vacuum Internals

In this chapter, we will cover the following recipes:

  • Dealing with bloating tables and indexes
  • Vacuuming and autovacuuming
  • Freezing and transaction ID wraparound
  • Monitoring vacuum progress
  • Controlling bloat using transaction age

Introduction

PostgreSQL provides MVCC (Multi Version Concurrency Control) to achieve one of the ACID properties called isolation. Transactional isolation is nothing but achieving the maximum possible concurrency among concurrent transactions. PostgreSQL has implemented MVCC to achieve this concurrency by creating versions of each tuple when the tuple receives any modifications. For example, let's say that a tuple received n concurrent modifications. PostgreSQL will keep n versions of the same tuple ...

Get PostgreSQL High Performance Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.