Vacuum
If you surveyed a set of experienced PostgreSQL database administrators and asked what part of database maintenance requires the most work, the word "vacuum" would pop up quite often in those conversations. A combination of complexity and some unfortunate terminology choices makes this particular area of database management quite prone to problems and misunderstandings, relative to how little trouble most parts of PostgreSQL administration are.
The need for vacuum flows from the visibility approach described before. The root problem is that clients executing UPDATE
or DELETE
operations don't know everything happening on the server. They can't make the decision about whether the original, now dead, row can truly be deleted, which is only possible when there are in fact no clients left who need to see it. And sometimes the new rows are never actually committed, leaving behind a different sort of dead row: a rolled back one that never becomes visible.
Cleaning...