Received: from localhost (maia-5.hub.org [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id C4F839FB563; Thu, 26 Apr 2007 19:05:02 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.182]) (amavisd-maia, port 10024) with ESMTP id 28434-05; Thu, 26 Apr 2007 19:04:55 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from mailbox.samurai.com (mailbox.samurai.com [205.207.28.82]) by postgresql.org (Postfix) with ESMTP id 84D089FB51A; Thu, 26 Apr 2007 19:04:58 -0300 (ADT) Received: from localhost (mailbox.samurai.com [205.207.28.82]) by mailbox.samurai.com (Postfix) with ESMTP id 797B961D4E; Thu, 26 Apr 2007 18:04:57 -0400 (EDT) X-Virus-Scanned: by amavisd-new at mailbox.samurai.com Received: from mailbox.samurai.com ([205.207.28.82]) by localhost (mailbox.samurai.com [205.207.28.82]) (amavisd-new, port 10024) with LMTP id S6UNza6E9Io1; Thu, 26 Apr 2007 18:04:55 -0400 (EDT) Received: from [192.168.1.102] (d226-84-131.home.cgocable.net [24.226.84.131]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (No client certificate requested) by mailbox.samurai.com (Postfix) with ESMTP id 1574661D4C; Thu, 26 Apr 2007 18:04:55 -0400 (EDT) Subject: Re: row-level stats and last analyze time From: Neil Conway To: Guillaume Lelarge Cc: pgsql-docs@postgresql.org, pgsql-hackers , Tom Lane In-Reply-To: <1177450739.16415.249.camel@localhost.localdomain> References: <462B6CEB.4010109@lelarge.info> <1177450739.16415.249.camel@localhost.localdomain> Content-Type: text/plain Date: Thu, 26 Apr 2007 18:07:07 -0400 Message-Id: <1177625227.6440.61.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.10.1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200704/31 X-Sequence-Number: 4227 On Tue, 2007-04-24 at 17:38 -0400, Neil Conway wrote: > which included other modifications to reduce the pgstat I/O volume in > 8.1. I don't think this particular change was wise I looked into this a bit further: (1) I believe the reasoning for Tom's earlier change was not to reduce the I/O between the backend and the pgstat process: it was to keep the in-memory stats hash tables small, and to reduce the amount of data that needs to be written to disk. When the only stats messages we get for a table are VACUUM or ANALYZE messages, we discard the message in the pgstat daemon. (2) If stats_row_level is false, there won't be a stats hash entry for any tables, so we can skip sending the VACUUM or ANALYZE message in the first place, by the same logic. (This is more debatable if the user just disabled stats_row_level for the current session, although since only a super-user can do that, perhaps that's OK.) (3) I don't like the fact that the current coding is so willing to throw away VACUUM and ANALYZE pgstat messages. I think it is quite plausible that the DBA might be interested in the last-VACUUM and last-ANALYZE information for a table which hasn't had live operations applied to it recently. The rest of the pgstat code has a similarly disappointing willingness to silently discard messages it doesn't think are worth keeping (e.g. pgstat_recv_autovac() is ignored for databases with no other activity, and pgstat_count_xact_commit/rollback() is a no-op unless *either* row-level or block-level stats are enabled.) If we're so concerned about saving space in the stats hash tables for tables that don't see non-VACUUM / non-ANALYZE activity, why not arrange to record the timestamps for database-wide VACUUMs and ANALYZEs separately from table-local VACUUMs and ANALYZEs? That is, a table's last_vacuum time could effectively be the max of the last database-wide vacuum time and the last VACUUM on that particular table. (Recording the time of the last database-wide VACUUM might be worth doing anyway, e.g. for avoiding wraparound failure). Comments? -Neil