Received: from localhost (maia-1.hub.org [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id 9808A9FB790 for ; Fri, 11 May 2007 14:25:15 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-maia, port 10024) with ESMTP id 41532-01 for ; Fri, 11 May 2007 14:25:11 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from lists.commandprompt.com (host-254.commandprompt.net [207.173.203.254]) by postgresql.org (Postfix) with ESMTP id 4EFC89FB785 for ; Fri, 11 May 2007 14:25:11 -0300 (ADT) Received: from perhan.alvh.no-ip.org (201-221-217-243.bk12-dsl.surnet.cl [201.221.217.243]) (authenticated bits=0) by lists.commandprompt.com (8.13.7/8.13.6) with ESMTP id l4BHP7op010257; Fri, 11 May 2007 10:25:08 -0700 Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id D438932A13; Fri, 11 May 2007 13:25:04 -0400 (CLT) Date: Fri, 11 May 2007 13:25:04 -0400 From: Alvaro Herrera To: Guillaume Cottenceau Cc: pgsql-performance@postgresql.org Subject: Re: estimating the need for VACUUM FULL and REINDEX Message-ID: <20070511172504.GH17314@alvh.no-ip.org> References: <87odkvmsav.fsf@meuh.mnc.lan> <87lkfve5r3.fsf@meuh.mnc.lan> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87lkfve5r3.fsf@meuh.mnc.lan> User-Agent: Mutt/1.5.13 (2006-08-11) X-Virus-Scanned: ClamAV version 0.88.5, clamav-milter version 0.88.5 on projects.commandprompt.com X-Virus-Status: Clean X-Greylist: Sender succeded SMTP AUTH authentication, not delayed by milter-greylist-1.6 (lists.commandprompt.com [192.168.2.159]); Fri, 11 May 2007 10:25:08 -0700 (PDT) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200705/234 X-Sequence-Number: 24624 Guillaume Cottenceau wrote: > Guillaume Cottenceau writes: > > > With that in mind, I've tried to estimate how much benefit would > > be brought by running VACUUM FULL, with the output of VACUUM > > VERBOSE. However, it seems that for example the "removable rows" > > reported by each VACUUM VERBOSE run is actually reused by VACUUM, > > so is not what I'm looking for. > > I've tried to better understand how autovacuum works (we use 7.4) > to see if a similar mechanism could be used in 7.4 (e.g. run > VACUUM ANALYZE often enough to not end up with a need to VACUUM > FULL). > > The autovacuum daemon uses statistics collected thanks to > stats_row_level. However, inside pg_stat_user_tables, the values > n_tup_upd and n_tup_del seem to be reported from pg startup and > never reset, whereas the information from previous VACUUM would > be needed here, if I understand correctly. Is there anything that > can be done from that point on with existing pg information, or > I'd need e.g. to remember the values of my last VACUUM myself? In 7.4 there was the pg_autovacuum daemon in contrib, wasn't there? No need to write one yourself. AFAIR what it did was precisely to remember the numbers from the last vacuum, which was cumbersome and not very effective (because they were lost on restart for example). Also, the new autovac has some features that the old one didn't have. Ability to set per-table configuration for example. -- Alvaro Herrera http://www.CommandPrompt.com/ The PostgreSQL Company - Command Prompt, Inc.