Monitor VACUUM progress on a large table
VACUUM prints nothing until it is done. pg_stat_progress_vacuum names the phase and the block counter, so you can tell 3,445 of 19,608 blocks scanned from a job that has quietly stalled.
Problem
What you're actually looking at
The symptom as it shows up on a real server.
A long VACUUM looks identical to a hung VACUUM from the outside. pg_stat_activity gives you the query text and a start time and nothing else, so the usual reaction is to cancel it, which throws away every dead item ID collected so far and guarantees the next run is just as slow.
freight_manifest carries 2,000,000 live rows and 666,666 dead ones left behind by a bulk delete. The maintenance window vacuum has been running for a while and the on-call engineer needs to decide whether to wait it out.
Simple terms
A long VACUUM and a hung VACUUM look identical from the outside, and the usual reaction, cancel it, is the worst move, because it throws away all the cleanup done so far and the next run starts from scratch. pg_stat_progress_vacuum shows which phase it is in and how many blocks it has scanned out of the total, so you can tell a job that is steadily working from one that has genuinely stalled, and choose to wait rather than kill it.
Full runbook for this incident
- The full identify checklist, the exact signals that tell you it's this incident
- Every diagnostic query; lab output is attached only to the steps we actually captured
- The resolution path and the pitfalls that make it worse
- Mitigation steps to stop it recurring, plus a verify-you're-done query
Card required. Cancel before day 7 and you are not charged.
More in this category
Other Observability runbooks
Neighbouring incidents that share the same diagnostic surface.
Connected
How this connects to the rest of the library
A live view of this page's real cross-references, what explains it, what fixes it, what to tune, and where to go next. Every link is an authored relationship, not a guess.
Fixes these errors
Need the full procedure?
Pro runbooks finish the incident path
Free runbooks teach the shape. Pro opens the full step transcript, edge cases, and prevention depth.