X-Original-To: pgsql-admin@postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by developer.postgresql.org (Postfix) with ESMTP id 47BEE925BE7 for ; Thu, 29 May 2003 07:25:42 -0400 (EDT) Received: from developer.postgresql.org ([64.117.224.193]) by localhost (developer.postgresql.org [64.117.224.193:10024]) (amavisd-new) with ESMTP id 27996-01 for ; Thu, 29 May 2003 07:25:41 -0400 (EDT) Received: from wolff.to (wolff.to [66.93.249.74]) by developer.postgresql.org (Postfix) with SMTP id 4360B925BD4 for ; Thu, 29 May 2003 07:25:41 -0400 (EDT) Received: (qmail 11471 invoked by uid 500); 29 May 2003 11:27:54 -0000 Date: Thu, 29 May 2003 06:27:54 -0500 From: Bruno Wolff III To: Michael Mattox Cc: pgsql-admin@postgresql.org Subject: Re: Vacuum strategies Message-ID: <20030529112754.GE11002@wolff.to> Mail-Followup-To: Michael Mattox , pgsql-admin@postgresql.org References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.4i X-Virus-Scanned: by amavisd-new X-Archive-Number: 200305/396 X-Sequence-Number: 8958 On Thu, May 29, 2003 at 12:21:44 +0200, Michael Mattox wrote: > When I run vacuum (I usually do "vacuum full verbose analyze"), I get a > message saying vacuum should only be performed when no one is using the > database. My database is used for a website which is active 24 hours a day, > so I'm curious what kind of vacuum strategy I should use? Should I shut > down the website to vacuum or should I just schedule the vacuum to run in > the middle of the night? So far I've been doing it while the website is > running without any problems. Vacuum full exclusively locks tables and can hurt performance if tables are big. If you are running 7.3, you normally won't need to run vacuum full. Vacuum should be run when a significant fraction of rows in a table have been deleted or updated or at least every 10^9 transactions. Analyse needs to be run after inserts, updates or deletes have significantly impacted the statistics for a table.