I am trying to find the number of vacuum-eligible tuples in one of our postgres tables. This is the output of vacuum verbose on that table
INFO: "act_msgs": found 0 removable, 2217083 nonremovable row versions in 314492 out of 314492 pages DETAIL: 2185476 dead row versions cannot be removed yet. There were 62133 unused item pointers.
Before running the vacuum the live and dead tuple counts were n_live_tup => 2204051 and n_dead_tup => 12370. After running the vacuum they are n_live_tup => 2217220 and n_dead_tup => 9. So it looks like if vacuum cannot remove the actually deleted tuples it adds those tuples to live_tup.
Now, we know that we have a long running transaction opened by the application and that is causing the auto vacuum not able to clean up the dead tuples. The application would do frequent inserts and deletes. How do i find the number of tuples that were actually deleted and would be vacuumed when that transaction is closed?