Avoiding auto-freezing and page corruptions

There are some aspects of VACUUM whose reason to exist is complex to explain, and occasionally they have negative behavior. Let's look more deeply at those and find some solutions.

Getting ready

PostgreSQL performs regular sweeps to clean out old transaction identifiers, which is known as "freezing". It does this to defer transaction wraparound, which is discussed in more detail in the next recipe.

There are two routes that a row can take in PostgreSQL: a row version dies and needs to be removed by VACUUM, or a row version gets old enough and needs to be frozen, which is also performed by the VACUUM process.

Why do we care? Say, we load a table with 100 million rows, and everything is fine. When those rows ...

Get PostgreSQL 9 Administration Cookbook - Second Edition 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.