Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 71BC3B5DBE4 for ; Tue, 9 Aug 2011 12:03:44 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 15949-09 for ; Tue, 9 Aug 2011 15:03:38 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id EE49DB5D800 for ; Tue, 9 Aug 2011 12:03:37 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id p79F3Wai017366; Tue, 9 Aug 2011 11:03:32 -0400 (EDT) To: Tom Lanyon cc: pgsql-admin@postgresql.org Subject: Re: PD_ALL_VISIBLE flag set - autovacuum ignoring dead tuples In-reply-to: References: Comments: In-reply-to Tom Lanyon message dated "Wed, 03 Aug 2011 23:53:28 +0930" Date: Tue, 09 Aug 2011 11:03:31 -0400 Message-ID: <17365.1312902211@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.712 tagged_above=-10 required=5 tests=BAYES_00=-1.9, RP_MATCHES_RCVD=-0.812 X-Spam-Level: X-Archive-Number: 201108/51 X-Sequence-Number: 38038 Tom Lanyon writes: > I'm seeing a heavy-update TOAST table which is not being effectively autovacuum'd on 8.4.5. The stats collector shows n_dead_tup growing very quickly, and autovacuum runs frequently, but never removes any dead tuples. A manual vacuum does 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...' warnings emitted during the autovacuum run. If that were the issue, manual vacuums would be subject to it too. regards, tom lane