"S. Bob" <sbob@xxxxxxxxxxxxxxxxxxxxx> writes: > we have a table that consistently has 2x the number of dead rows than > live rows. > I've done some digging and it looks like somehow the application is > holding shared locks that force vacuum to not cleanup rows. This is not a locking issue; if it were, vacuum would be unable to scan the table at all. What it is is a snapshot issue: that is, some transaction has a snapshot that's old enough to allow it to see those dead rows if it were to look. So vacuum can't remove the rows for fear of causing transactional consistency failures. What you want to do is look into pg_stat_activity for transactions with very old start times, and then cancel them or otherwise force them to terminate. Also, if there are no obvious candidates there, you might be having a problem with prepared transactions --- look into pg_prepared_xacts to see if there are any old ones of those. regards, tom lane