HeadlinesBriefing favicon HeadlinesBriefing.com

PostgreSQL Transaction ID Wraparound: Silent Database Killer

Hacker News •
×

A mid-sized B2B SaaS company experienced a complete write outage when their PostgreSQL database reached the transaction ID wraparound limit. The database had been running for several years with a stable workload of approximately 10 write transactions per second. Despite appearing healthy in monitoring dashboards, the system had silently approached the critical 2-billion transaction ID threshold.

Years earlier, the team had disabled autovacuum to resolve disk I/O issues, never re-enabling it. This configuration decision, combined with PostgreSQL's 32-bit transaction ID counter, created a ticking time bomb. The database operated normally for years while transaction IDs continued advancing. When the safety limit was reached, PostgreSQL deliberately blocked all write operations to prevent data corruption, leaving the system effectively read-only.

Recovery required aggressive manual VACUUM FREEZE operations and identifying long-running transactions. The incident revealed that multiple production databases had similarly high transaction ID ages. This class of failure cannot be reproduced through conventional testing since it emerges only after months or years of normal operation, making it easy to overlook during staging validation or initial production rollout.