Re: PD_ALL_VISIBLE flag set - autovacuum ignoring dead tuples - Mailing list pgsql-admin

From Tom Lane
Subject Re: PD_ALL_VISIBLE flag set - autovacuum ignoring dead tuples
Date
Msg-id 17365.1312902211@sss.pgh.pa.us
Whole thread Raw
In response to PD_ALL_VISIBLE flag set - autovacuum ignoring dead tuples  (Tom Lanyon <tom+pgsql-admin@oneshoeco.com>)
List pgsql-admin
Tom Lanyon <tom+pgsql-admin@oneshoeco.com> writes:
> I'm seeing a heavy-update TOAST table which is not being effectively autovacuum'd on 8.4.5.  The stats collector
showsn_dead_tup growing very quickly, and autovacuum runs frequently, but never removes any dead tuples.  A manual
vacuumdoes find many dead tuples (90+ % of the table) to remove, and removes them properly. 

Is autovacuum actually running against the toast table?  Check the
last_autovacuum column in pg_stat_all_tables.  If not, and if pg_class'
relpages/reltuples columns seem pretty out of date for the toast table,
this might be a variant of the problem reported here:
http://archives.postgresql.org/pgsql-admin/2011-05/msg00101.php
which was patched here:
http://git.postgresql.org/gitweb/?p=postgresql.git&a=commitdiff&h=b503da135ab0bdd97ac3d3f720c35854e084e525
although that patch hasn't actually made it into any shipping release
yet :-(

I'm not entirely convinced that you're seeing a related issue, because
Florian was complaining of too many autovacuums not too few, but if you
cross your eyes a bit and assume the symptom is "poor autovacuum
scheduling" then maybe the same problem explains both.

Another post-8.4.5 bug fix that could affect autovacuum's promptness is
http://git.postgresql.org/gitweb/?p=postgresql.git&a=commitdiff&h=fab2af30d6bb4ca893e2e9bf96863e6f1ce826d2

> Whilst debugging, I found that there seems to be a large amount of the old 'PD_ALL_VISIBLE incorrectly set...'
warningsemitted during the autovacuum run. 

If that were the issue, manual vacuums would be subject to it too.

            regards, tom lane

pgsql-admin by date:

Previous
From: jtkells@verizon.net
Date:
Subject: PGDATA not accessible; please fix the directory permissions ($PGDATA should be world readable)
Next
From: Raghavendra
Date:
Subject: Re: Postgres process