Andreas Scherbaum explains what Transaction ID Wraparound is and how you can avoid it:
PostgreSQL uses Multi-Version Concurrency Control (MVCC) to manage concurrent access to the database, and store each version of a tuple in a table. To keep the database efficient, PostgreSQL employs a cleanup process called VACUUM, which removes unnecessary tuples. This not only saves disk space and keeps the database size under control, it also prevents the dreaded “Transaction ID Wraparound” issue. Regularly running VACUUM is crucial, including on the
template0
database, which is normally handled by the Autovacuum daemon. However, sometimes manual intervention is necessary.
Read on to learn more.