Received: from localhost (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 0096064FCE3 for ; Thu, 18 Dec 2008 09:13:59 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 27220-10 for ; Thu, 18 Dec 2008 09:13:52 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from a.mail.sonomait.com (a.mail.sonomait.com [64.142.123.30]) by mail.postgresql.org (Postfix) with ESMTP id 0BA5A64FCE9 for ; Thu, 18 Dec 2008 09:13:51 -0400 (AST) Received: from localhost (localhost.localdomain [127.0.0.1]) by a.mail.sonomait.com (Postfix) with ESMTP id 9D16C164581; Thu, 18 Dec 2008 05:13:48 -0800 (PST) X-Virus-Scanned: amavisd-new at Received: from a.mail.sonomait.com ([127.0.0.1]) by localhost (a.mail.sonomait.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id U8bkt+-j-jnP; Thu, 18 Dec 2008 05:13:46 -0800 (PST) Received: from [172.18.30.70] (89-96-142-243.ip12.fastwebnet.it [89.96.142.243]) by a.mail.sonomait.com (Postfix) with ESMTP id BBAC31B9DE74; Thu, 18 Dec 2008 05:13:45 -0800 (PST) Message-ID: <494A4C85.9090700@gmail.com> Date: Thu, 18 Dec 2008 14:13:41 +0100 From: Stefano Nichele User-Agent: Thunderbird 2.0.0.18 (Windows/20081105) MIME-Version: 1.0 To: Alvaro Herrera CC: pgsql-admin@postgresql.org Subject: Re: tracking last_autovacuum References: <494A49CA.4050905@gmail.com> <20081218130730.GC5447@alvh.no-ip.org> In-Reply-To: <20081218130730.GC5447@alvh.no-ip.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200812/145 X-Sequence-Number: 30978 Yes, i could do that but it seems simpler (to me) with a trigger than looking at the recent changes records and store them somewhere. ste Alvaro Herrera wrote: > Stefano Nichele escribió: > >> Hi All, >> in pg_stat_all_tables, the fields last_autovacuum, last_autoanalyze are >> updated any time autovacuum vacuums a table. >> I would like to keep an history of these activities in order to see when >> and how many times any single table is vacuumed. >> >> Is there any features that can help me ? (I'm using postgres 8.2.9) >> >> What about creating a trigger on pg_stat_all_tables and storing the >> required info in another table (like autovacuum_history) ? >> > > I guess you could run a query once every autovacuum_naptime and have it > save aside all those entries from pg_stat_all_tables that have recent > dates into a history table. > >