Back to all use cases
PostgreSQLSaaS

The database that stopped accepting writes

A SaaS platform's PostgreSQL database is nearing the transaction ID limit because a forgotten replication slot holds back vacuum. If the age keeps climbing, PostgreSQL warns and then stops accepting writes.

Challenge

PostgreSQL numbers transactions with a 32-bit counter, so vacuum has to freeze old rows before the counter catches up with them. When it cannot, the server first warns, and at the last margin it refuses commands that assign new transaction IDs. The database stays readable and the application cannot write.

The usual cause is not a lack of vacuum. Something pins the oldest transaction that vacuum has to respect: a replication slot nobody consumes, a transaction left open for days, or a prepared transaction nobody finished. Autovacuum keeps running and cannot freeze past the pin. On a very large table, a vacuum that starts late has a long way to go, and writes stay refused until it finishes.

The warning is easy to miss for the same reason the cause is. Nothing looks broken until transaction ID age is on a graph and someone reads it.

Environment

A multi-tenant SaaS platform on self-managed PostgreSQL with streaming replication and at least one replication slot left over from an earlier project. The largest table takes most of the writes, and autovacuum settings are the defaults.

Monitoring watches CPU, disk and connections. It does not watch transaction ID age or replication slots.

Options

Handle it in-house. A DBA who has seen this before can clear the pin and run the vacuum. Without that person, the first reading of the documentation happens during the outage.

Order a one-time database health check. The fixed-scope review looks at transaction ID age, replication slots, dead tuples and the largest tables, and ends in a ranked written report. Making the changes is yours to do, or OSSeva can quote it separately.

Add OSSeva Assure for 24/7 reactive support. If the age is already close to the limit, you can raise the issue at any hour and an engineer works it. Assure also includes a performance and vacuum configuration audit.

Add OSSeva Operate to prevent the next one. Monitoring, runbooks and VACUUM and analyze tuning move to engineers who watch them every day.

Approach

If the database is already close, OSSeva Assure's 24/7 reactive support is the first call. The work is to find what pins the vacuum horizon, release it, and get freezing to finish on the tables that matter, in the order that returns writes soonest.

Prevention is Operate's job. Discovery records the monitoring gaps, and on a platform like this one the gaps to close are transaction ID age per database, replication slots that are inactive or lagging, and long-running transactions. The runbooks written for the environment give every alert a remediation path before OSSeva goes on call. Operate's VACUUM and analyze tuning then sets autovacuum per table, so the largest tables are not left on defaults, and the quarterly capacity review keeps the trend in front of both teams.

What this delivers

An engineer on call when the age is already close, and afterward a platform where the warning arrives long before the stop point, with a named person who owns the response. OSSeva PostgreSQL support is priced per cluster. Book a discovery call for a quote.

Go deeper

Questions

Frequently asked questions

Book a 15-minute call

What happens when PostgreSQL reaches the transaction ID limit?

It warns first, then refuses commands that assign new transaction IDs. Reads still work, and writes fail until vacuum has frozen enough old rows.

Can a replication slot cause transaction ID wraparound?

It can contribute. A slot that nobody consumes can hold back the oldest transaction vacuum must respect, so autovacuum runs without being able to freeze. Long open transactions and unfinished prepared transactions do the same.

Does the database health check look at transaction ID age?

Yes. Transaction ID age is part of the capacity checks for PostgreSQL, next to replication slots, dead tuple build-up and autovacuum behavior on the largest tables.

Does Assure monitor the database for this?

No. Assure includes 24/7 reactive support when you raise an issue, plus an audit. Proactive monitoring and the 15-minute P1 response come with Operate.

See every EOL & CVE-patching use case

All use cases
Book a call