Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id BDEC01336FA7 for ; Mon, 20 Sep 2010 23:12:39 -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 55747-04 for ; Tue, 21 Sep 2010 02:12:34 +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 561BF1336DB6 for ; Mon, 20 Sep 2010 23:12:32 -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 o8L2CVhU021217; Mon, 20 Sep 2010 22:12:31 -0400 (EDT) To: Joe Miller cc: pgsql-performance@postgresql.org Subject: Re: Auto ANALYZE criteria In-reply-to: References: Comments: In-reply-to Joe Miller message dated "Mon, 20 Sep 2010 16:38:37 -0400" Date: Mon, 20 Sep 2010 22:12:31 -0400 Message-ID: <21216.1285035151@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-10 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201009/120 X-Sequence-Number: 40323 Joe Miller writes: > The autovacuum daemon currently uses the number of inserted and > updated tuples to determine if it should run VACUUM ANALYZE on a > table.  Why doesn’t it consider deleted tuples as well? I think you misread the code. Now there *is* a problem, pre-9.0, if your update pattern is such that most or all updates are HOT updates. To quote from the 9.0 alpha release notes: Revise pgstat's tracking of tuple changes to improve the reliability of decisions about when to auto-analyze. The previous code depended on n_live_tuples + n_dead_tuples - last_anl_tuples, where all three of these numbers could be bad estimates from ANALYZE itself. Even worse, in the presence of a steady flow of HOT updates and matching HOT-tuple reclamations, auto-analyze might never trigger at all, even if all three numbers are exactly right, because n_dead_tuples could hold steady. It's not clear to me if that matches your problem, though. regards, tom lane