Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 930D7632D27 for ; Mon, 16 Aug 2010 16:51:51 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 87163-04 for ; Mon, 16 Aug 2010 19:51:43 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.187]) by mail.postgresql.org (Postfix) with ESMTP id F1870632BC8 for ; Mon, 16 Aug 2010 16:51:43 -0300 (ADT) Received: from [192.168.1.151] (static-71-179-240-8.bltmmd.fios.verizon.net [71.179.240.8]) by mrelayeu.kundenserver.de (node=mrbap0) with ESMTP (Nemesis) id 0MIyEr-1OicsO1eQb-002ffw; Mon, 16 Aug 2010 21:51:42 +0200 Message-ID: <4C6996CB.9090808@2ndquadrant.com> Date: Mon, 16 Aug 2010 15:51:39 -0400 From: Greg Smith User-Agent: Thunderbird 2.0.0.24 (X11/20100317) MIME-Version: 1.0 To: Tom Lane CC: Peter Koczan , pgsql-admin@postgresql.org Subject: Re: Is regular vacuuming with autovacuum needed? References: <19036.1281983716@sss.pgh.pa.us> In-Reply-To: <19036.1281983716@sss.pgh.pa.us> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: V02:K0:4XPJfmEDQg0csfuJEfe4bzbI2BDv+fIxIwf+BE6qwEd Q+iCBo2IQ5xtOueKi2ZrHOVYstf/XQ0y6znDkXS1t3sW/XEOjb RbmdKVmzBHpGNeNtOCGrp6vXisb+A7oemwh4hm6YHcGYe2OAxV hai7+FOVrnUL3jgIA47C01ZZeJkhislCq9cd+RXDCMfE6vmDy2 v83LUfhQAI0p/RykmDv4UILh8CMkGtFNVyhQU1MTxs= X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-10 required=5 tests=BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001 X-Spam-Level: X-Archive-Number: 201008/121 X-Sequence-Number: 35370 Tom Lane wrote: > On versions where autovacuum is on by default, I would certainly > recommend trying to use only autovacuum. cron-driven vacuum still > has some uses but they are corner cases. > Corner cases implies something a bit more rare than I'd consider the case here. Consider a server where you know you have a large table that ends up with 5% dead rows each day. This will cause autovacuum to kick in to clean up about every 4 days, at the defaults where autovacuum_vacuum_scale_factor = 0.2. When it does finally get to that table, it's going to have a fairly large amount of work to do. If that happens during peak load time on your server, you may find that a painful shock. In that situation, it's completely reasonable to manually vacuum that table each day during a known slow period, late at night for example. Then it will never get to where it's so bloated that a hefty autovacuum kicks in at an unpredictable time. The other alternative here is to just tune autovacuum so it runs really slowly, so it won't kill responsiveness during any peak period. While in theory that's the right thing to do, this is much harder to get working well than what I just described. -- Greg Smith 2ndQuadrant US Baltimore, MD PostgreSQL Training, Services and Support greg@2ndQuadrant.com www.2ndQuadrant.us