Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 46B79634196 for ; Mon, 1 Mar 2010 03:27:43 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 72193-06-5 for ; Mon, 1 Mar 2010 07:27:32 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-ww0-f46.google.com (mail-ww0-f46.google.com [74.125.82.46]) by mail.postgresql.org (Postfix) with ESMTP id 7BD416361AA for ; Mon, 1 Mar 2010 02:58:29 -0400 (AST) Received: by wwa36 with SMTP id 36so1143939wwa.19 for ; Sun, 28 Feb 2010 22:58:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=gca58jLCv4p46jXvAlbkA5NvaNqCqvxiPseD+mzGnbc=; b=gROeZ5fe+1WguHhsVo7LIjYXSbmZkQsH4Uleip9+2iXMwMFJ0FiwxBeDMurbs51Lbe eL8qzuBXCzZiU6iwPwkqgssO+fYRPp0rUJ7WStjxOCAbgJ7TF62bniuCUDRFDKqNdAlr 7y5j5k9hCupD10/rTiatHX0VxDWyxP8JLhVgw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=QUK8JalgF/qv4k/Kcpz/XdY1k/Nptd9hv4VBiAff1plv2gBb9ALmU4FNmrmy8aBsdk 3HEoR0inPPqpSDYwJ7w4dCWL2pKNjF4v388TB2kzBMB5ll9BGyu3y6RD/gMHeqqW2u8n ZvQyUX2DewHdk8c5mKOnJ7m7rLxU1OXLcHAw8= MIME-Version: 1.0 Received: by 10.216.93.15 with SMTP id k15mr2660299wef.103.1267426708119; Sun, 28 Feb 2010 22:58:28 -0800 (PST) In-Reply-To: References: <4AB8D9AA.6050007@ummon.com> <4AB8E145.4040901@squeakycode.net> Date: Sun, 28 Feb 2010 23:58:28 -0700 Message-ID: Subject: Re: Autovacuum Tuning advice From: Scott Marlowe To: "Plugge, Joe R." Cc: "pgsql-performance@postgresql.org" Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.599 tagged_above=-10 required=5 tests=BAYES_00=-2.599 X-Spam-Level: X-Archive-Number: 201003/2 X-Sequence-Number: 37827 On Sun, Feb 28, 2010 at 8:09 PM, Plugge, Joe R. wrote: > I have a very busy system that takes about 9 million inserts per day and = each record gets updated at least once after the insert (all for the one sa= me table), there are other tables that get hit but not as severely. =A0As s= uspected I am having a problem with table bloat. =A0Any advice on how to be= more aggressive with autovacuum? =A0I am using 8.4.1. =A0My machine has 4 = Intel Xeon =A03000 MHz Processors with 8 GB of Ram. What kind of drive system do you have? That's far more important than CPU and RAM. Let's look at a two pronged attack. 1: What can you maybe do to reduce the number of updates for each row. if you do something like: update row set field1=3D'xyz' where id=3D4; update row set field2=3D'www' where id=3D4; And you can combine those updates, that's a big savings. Can you benefit from HOT updates by removing some indexes? Updating indexed fields can cost a fair bit more than updating indexed ones IF you have a < 100% fill factor and therefore free room in each page for a few extra rows. 2: Vacuum tuning. > > Currently I am using only defaults for autovac. This one: > #autovacuum_vacuum_cost_delay =3D 20ms is very high for a busy system with a powerful io subsystem. I run my production servers with 1ms to 4ms so they can keep up. Lastly there are some settings you can make per table for autovac you can look into (i.e. set cost_delay to 0 for this table), or you can turn off autovac for this one table and then run a regular vac with no cost_delay on it every minute or two.