Received: from localhost (maia-3.hub.org [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id 425129F9F3A for ; Mon, 27 Aug 2007 18:00:53 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 66295-01-8 for ; Mon, 27 Aug 2007 18:00:41 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id 8A73A9F9F9B for ; Mon, 27 Aug 2007 18:00:45 -0300 (ADT) Received: by noel.decibel.org (Postfix, from userid 1001) id ED0375646A; Mon, 27 Aug 2007 16:00:43 -0500 (CDT) Received: (hashcash-sendmail, from uid 1001); Mon, 27 Aug 2007 16:00:41 -0500 Date: Mon, 27 Aug 2007 16:00:41 -0500 From: Decibel! To: Bill Moran Cc: Kevin Kempter , Pgsql performance Subject: Re: significant vacuum issues - looking for suggestions Message-ID: <20070827210041.GN54309@nasby.net> References: <200708241357.23629.kevin@kevinkempterllc.com> <20070824164144.93ce05bf.wmoran@collaborativefusion.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="eUJndGal4TJgqj0h" Content-Disposition: inline In-Reply-To: <20070824164144.93ce05bf.wmoran@collaborativefusion.com> X-Operating-System: FreeBSD 6.1-RELEASE-p10 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.13 (2006-08-11) X-Hashcash: 1:20:070827:wmoran@collaborativefusion.com::UjlV0HUudQJZr++5:0000000 0000000000000000000000000Jth X-Hashcash: 1:20:070827:kevin@kevinkempterllc.com::wtBIKFTVBOUlV5g1:000000000000 0000000000000000000000001uN3 X-Hashcash: 1:20:070827:pgsql-performance@postgresql.org::HiluFqWvASjte2zl:00000 0000000000000000000000000tAN X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200708/326 X-Sequence-Number: 26456 --eUJndGal4TJgqj0h Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Aug 24, 2007 at 04:41:44PM -0400, Bill Moran wrote: > In response to Kevin Kempter : >=20 > > Hi List; > >=20 > > I've just started working with a client that has been running Postgres = (with=20 > > no DBA) for a few years. They're running version 8.1.4 on 4-way dell b= oxes=20 > > with 4Gig of memory on each box attached to RAID-10 disk arrays.=20 > >=20 > > Some of their key config settings are here: > > shared_buffers =3D 20480 > > work_mem =3D 16384 > > maintenance_work_mem =3D 32758 >=20 > Before you do any of those other things, bump shared_buffers to about > 120000 and maintenance_work_mem to 250000 or so -- unless this box > has other applications on it using significant amounts of those 4G of > RAM. You may find that these changes alone are enough to get vacuum > to complete. You'll need to restart the server for the shared_buffers > setting to take effect. For the really bloated table, you might need to go even higher than 250000 for maint_work_mem. IIRC vacuum needs 6 bytes per dead tuple, so that means 43M rows... with 5M dead pages, that means less than 10 rows per page, which is unlikely. Keep in mind that if you do a vacuum verbose, you'll be able to see if vacuum runs out of maintenance_work_mem, because you'll see multiple passes through all the indexes. You could also potentially use this to your benefit. Set maint_work_mem low enough so that vacuum will have to start it's cleaning pass after only an hour or so... depending on how big/bloated the indexes are on the table, it might take another 2-3 hours to clean everything. I believe that as soon as you see it start on the indexes a second time you can kill it... you'll have wasted some work, but more importantly you'll have actually vacuumed part of the table. But all of that's a moot point if they're running the default free space map settings, which are way, way, way to conservative in 8.1. If you've got one table with 5M dead pages, you probably want to set fsm_pages to at least 50000000 as a rough guess, at least until this is under control. Keep in mind that does equate to 286M of memory, though. As for your pg_dump idea... why not just do a CREATE TABLE AS SELECT * FROM bloated_table? That would likely be much faster than messing around with pg_dump. What kind of disk hardware is this running on? A good raid 10 array with write caching should be able to handle a 200G database fairly well; at least better than it is from what I'm hearing. --=20 Decibel!, aka Jim Nasby decibel@decibel.org EnterpriseDB http://enterprisedb.com 512.569.9461 (cell) --eUJndGal4TJgqj0h Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.3 (FreeBSD) iD8DBQFG0zt5dO30qud8SkgRAjsTAKDW9ZJD5in35LDcnw4QjdSgnUhlTACfetxV 9eXwEbQGYI1ACVz8AonmfOU= =2+1s -----END PGP SIGNATURE----- --eUJndGal4TJgqj0h--