PostgreSQL MVCC and Tuple Visibility: Why Your Table Has More Dead Rows Than Live Ones
A table with one million live rows was holding five million dead ones, and queries were scanning all six. Understanding xmin, xmax, and how PostgreSQL decides what a query can see explains where the dead rows come from.