Quick revision
The short answer
We would split ownership along what each side controls: the platform team owns autovacuum defaults, cluster-wide guardrails such as idle_in_transaction_session_timeout and statement_timeout, and alerts on bloat, dead tuple ratio, oldest transaction age, replication slots and wraparound age; product teams own their tables' access patterns and per-table settings, documented in their schema repository. Practised runbooks for pg_repack and emergency freeze, plus a review of new schemas for update-heavy designs, keep problems from reaching production.
What to remember
In this answer, we saw that vacuum health on a shared cluster is shared, because one open transaction or one huge table affects every schema. The platform team owns autovacuum defaults, guardrails such as idle_in_transaction_session_timeout and statement_timeout, alerts on bloat, dead tuples, transaction age, slots and wraparound, and practised runbooks for pg_repack and emergency freeze. Product teams own their access patterns and per-table settings, documented in their schema repositories, and a schema review catches update-heavy designs before they ship.
Your turn
Answer it aloud as you would in the interview, or type your answer below. Then show one part at a time and compare.
We would split ownership along what each side controls: the platform team owns autovacuum defaults, cluster-wide guardrails such as idle_in_transaction_session_timeout and statement_timeout, and alerts on bloat, dead tuple ratio, oldest transaction age, replication slots and wraparound age; product teams own their tables' access patterns and per-table settings, documented in their schema repository. Practised runbooks for pg_repack and emergency freeze, plus a review of new schemas for update-heavy designs, keep problems from reaching production.
Why this question is asked
On a shared PostgreSQL cluster, one team's mistake becomes everyone's problem. A single forgotten transaction in one service stops vacuum for every schema in the database, and a badly designed queue table can eat the disk that 39 other teams share. Interviewers ask this design question to see whether we can define clear ownership for something that is both technical and organisational. In this answer, we will see why vacuum health is shared, split responsibilities between the platform and product teams, define the guardrails and alerts, prepare runbooks, and add a schema review that prevents the worst designs.
1Why Vacuum Health Is a Shared Problem
Vacuum removes dead row versions once no snapshot can see them. The oldest snapshot anywhere in the database, called the xmin horizon, decides what vacuum may remove in every table, not just the table that snapshot reads. So a reporting job in team A that leaves a transaction open for six hours causes bloat in team B's orders table.
The same is true for transaction ID wraparound: the age is tracked per database, and one huge unfrozen table can push the whole database towards the limit at which PostgreSQL refuses new writes. And autovacuum workers are a shared pool, three by default per cluster, so a few enormous tables can keep them busy while other tables wait. That is why the answer cannot be 'each team looks after its own schema'.
2Who Owns What
The split follows what each side can actually change. The platform team controls cluster settings, monitoring and the tools, so it owns those. Product teams control their schemas, queries and transaction handling, so they own those, and they are the only ones who can fix an access pattern.
| Area | Platform team | Product teams |
|---|---|---|
| Autovacuum defaults | sets and tunes cluster-wide | requests changes |
| Per-table settings | reviews, offers templates | owns, documents in schema repo |
| Timeouts and guardrails | sets cluster and role defaults | may lower for their roles |
| Alerts and dashboards | builds and runs them | receives alerts for their schemas |
| Access patterns | advises | owns: queues, counters, batch jobs |
| Runbooks and tools | owns pg_repack, freeze procedures | joins drills |
Notice that the per-table settings belong to teams, but they must be written down in the team's schema repository, next to the migration that created the table, with a reason. Then anyone on call can see why the jobs table has a zero scale factor.
3Guardrails That Protect Everyone
The most effective protection is cluster-wide limits that stop one session from holding the horizon for hours. idle_in_transaction_session_timeout ends sessions that began a transaction and then went quiet; statement_timeout stops runaway queries; and since PostgreSQL 17, transaction_timeout limits the total length of any transaction. We set them per role, so an interactive analyst role can have a longer limit than a service role, but nothing is unlimited.
We also limit replication slots, because an inactive slot holds back both WAL and, for logical slots, the catalog horizon. We set max_slot_wal_keep_size and alert on any slot that has been inactive for more than an hour.
4What We Alert On, and Who Gets Paged
Alerts have two levels. A page wakes someone at night only for things that will cause an outage within hours if nobody acts. A ticket is created for slow trends that a team should fix this week. Each alert names the schema and therefore the owning team, so a bloat ticket goes to the team that owns the table, while a horizon or wraparound page goes to platform on-call, who may then pull in the team.
- Wraparound age above 1 billion, or an inactive slot growing fast?YesPage platform on-call nowNoContinue
- Transaction or idle session older than 1 hour?YesPage platform; contact the owning teamNoContinue
- Dead tuple ratio or bloat estimate above threshold?YesTicket to the owning teamNoNo action
- Weekly review of trends per teambloat, autovacuum runs, cancellations
4 steps in order. Play them, or step through them one at a time.
5Runbooks Practised Before They Are Needed
Two procedures need to be ready. The bloat runbook covers checking that nothing holds the horizon, then using pg_repack to rebuild a table online, including the disk space it needs and how to stop it safely. The emergency freeze runbook covers finding the database and tables with the oldest relfrozenxid, removing blockers, and running VACUUM (FREEZE, VERBOSE) with high cost limits. Both are rehearsed in a non-production cluster at least twice a year, so the first time someone runs them is not during an incident.
6Reviewing New Schemas for Bloat Risks
Most bloat problems are designed in. A counter that every request increments, such as a single row holding total_page_views, creates a new row version for every update and becomes a hot spot. A large row, say a 4 KB document with a status column, updated every few seconds, rewrites 4 KB each time. A queue that deletes rows at high rates needs special autovacuum settings from day one.
So the schema review checklist used by platform reviewers asks: how often is each row updated, how large is it, which columns change, and how is old data removed. Alternatives are often simple: split the frequently changed columns into a narrow table, count in batches or in a separate store, set a lower fillfactor so HOT updates (updates that stay on the same page and skip index changes) are possible, or partition and drop instead of delete.
7Follow-up questions
Which metric would page someone at night, and which only creates a ticket?
Pages are for problems that become outages within hours: wraparound age crossing a high threshold such as 1 billion, an inactive replication slot growing pg_wal towards a full disk, or a transaction holding the horizon for more than an hour on a busy cluster. Tickets are for slower trends: a table's bloat estimate rising above, say, 50 percent, a dead tuple ratio above 20 percent, or autovacuum being cancelled repeatedly on one table. The rule is that a page must need action tonight; anything that can wait a day goes to the team's queue.
How do you get 40 teams to follow this?
Make the safe path the default: timeouts and alerts apply automatically, schema review is part of the migration pull request, and templates for common patterns such as queues come with the right settings. Then report bloat and incidents per team in the regular operations review, so the cost of ignoring it is visible.
Should teams be allowed to change autovacuum settings on their own tables?
Yes, because they know the access pattern, but through migrations that are reviewed and documented, not by running ALTER TABLE by hand in production. Platform reviews any change that makes vacuum less frequent.
8Conclusion
In this answer, we saw that vacuum health on a shared cluster is shared, because one open transaction or one huge table affects every schema. The platform team owns autovacuum defaults, guardrails such as idle_in_transaction_session_timeout and statement_timeout, alerts on bloat, dead tuples, transaction age, slots and wraparound, and practised runbooks for pg_repack and emergency freeze. Product teams own their access patterns and per-table settings, documented in their schema repositories, and a schema review catches update-heavy designs before they ship.
Open with
I would start from the fact that vacuum health is shared even if schemas are not. The xmin horizon is per database, so one team's open transaction blocks cleanup for everyone, and wraparound age and autovacuum workers are shared too.
Then, if they want more
So the platform team owns the cluster side: autovacuum defaults, alerts on bloat estimates, dead tuple ratio, oldest transaction age and wraparound age per database, and guardrails such as idle_in_transaction_session_timeout, statement_timeout and, on PostgreSQL 17, transaction_timeout, set per role, plus alerts on inactive replication slots and long transactions.
Product teams own their tables' access patterns and per-table settings, like aggressive autovacuum on a queue table, and they document them in the schema repository through reviewed migrations. Alerts route by schema: wraparound, slot growth and hour-long transactions page platform on-call, while bloat and dead tuple trends become tickets for the owning team.
The platform team keeps runbooks for pg_repack and emergency freeze and practises them in non-production. Finally, new schemas get a review for update-heavy designs, such as hot counter rows or large rows updated often, because most bloat is designed in and is cheapest to fix before the table exists.
About this answer
- Last updated
- 12 November 2026
- Versions it names
- PostgreSQL 17
- Checked
- Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
- Where the question comes from
- Written by Scrivio for practice. It is not taken from an interview.
- Official documentation
- PostgreSQL documentation
Report an issue with this answer
Copy the line below and send it to the author with what you found. It carries the address of this page.
Issue with "Define how vacuum health is monitored and owned across 40 product teams that each own...": https://scrivio-interview-library.netlify.app/databases/postgresql/27c863fa6b/