Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id E5E17632E38 for ; Mon, 4 Jan 2010 17:33:18 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 08179-02-4 for ; Mon, 4 Jan 2010 21:33:03 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from smtp.iplink.net (smtp.iplink.net [192.139.81.186]) by mail.postgresql.org (Postfix) with ESMTP id 4E940632A55 for ; Mon, 4 Jan 2010 17:33:08 -0400 (AST) Received: from [10.255.0.247] (fw.iplink.net [192.139.81.98]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.iplink.net (Postfix) with ESMTP id 60752A770C1; Mon, 4 Jan 2010 16:33:07 -0500 (EST) Message-ID: <4B425E93.1050207@alteeve.com> Date: Mon, 04 Jan 2010 16:33:07 -0500 From: Madison Kelly User-Agent: Thunderbird 2.0.0.23 (X11/20090817) MIME-Version: 1.0 To: Brad Nicholson Cc: Gary Doades , pgsql-performance@postgresql.org Subject: Re: DB is slow until DB is reloaded References: <4B423D22.7040803@alteeve.com> <4B424215.70605@pinpointresearch.com> <4B424FF6.40207@alteeve.com> <4B425222.7070905@gpdnet.co.uk> <4B425555.6020709@alteeve.com> <1262638856.29852.4.camel@bnicholson-desktop> In-Reply-To: <1262638856.29852.4.camel@bnicholson-desktop> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=1.575 tagged_above=-10 required=5 tests=AWL=-1.429, BAYES_40=-0.185, FH_DATE_PAST_20XX=3.188 X-Spam-Level: * X-Archive-Number: 201001/17 X-Sequence-Number: 36897 Brad Nicholson wrote: > I think you are going down the wrong route here - you should be looking > at preventative maintenance instead of fixing it after its broken. > > Ensure that autovacuum is running for the database (assuming that you > are on a relatively modern version of PG), and possibly tune it to be > more aggressive (we can help). > > This will ensure that the condition never comes up. > > ps - if you do go with the route specify, no need to VACUUM after the > CLUSTER. CLUSTER gets rid of the dead tuples - nothing for VACUUM to > do. > I wanted to get ahead of the problem, hence my question here. :) I've set this to run at night ('iwt' being the DB in question): su postgres -c "psql iwt -c \"VACUUM ANALYZE VERBOSE\" I will keep an eye on the output for a little while (it appends to a log) and see what it says. Also, I read that CLUSTER can mess up back ups as it makes tables look empty while running. If the above doesn't seem to help, I will swap out the VACUUM and run a CLUSTER before the ANALYZE and see how that works. Madi