Received: from localhost (maia-4.hub.org [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 4B5889FB35D for ; Sun, 6 May 2007 05:15:46 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 12280-05 for ; Sun, 6 May 2007 05:15:42 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.4 Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.171]) by postgresql.org (Postfix) with ESMTP id B362F9FB426 for ; Sun, 6 May 2007 05:15:41 -0300 (ADT) Received: by ug-out-1314.google.com with SMTP id k3so700066ugf for ; Sun, 06 May 2007 01:15:40 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:user-agent:mime-version:to:cc:subject:references:in-reply-to:content-type:content-transfer-encoding:sender; b=c60qr3PGAtqEtbxXupUJ5RPb47EUz3L2tUoA4XKSM2PF4bm8YWPWjA8ysgLFuxFoNo3yqouvMGSJNL4DZsIlIZt43Q3doUXVS+gC43ZWJeeUo2MEqXYmzQwy1EqA2gyF5loyozhVZJ45QTcyx8dNravHsQh004Y1EFCFv4CcJ20= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:user-agent:mime-version:to:cc:subject:references:in-reply-to:content-type:content-transfer-encoding:sender; b=j1kqeZ+iLINyHQZ3GkjLI1+DozpUIa3FBXnrhe/RPcEVZj5goxNw6XFDhGUJKj0m4HabSqJYrbH3Zb4gwdja3aEA7Vp0XttH8jFVOUue5DQubHvc9LByjI8TkswpEtgrZXum1iHDd/AN7wHwVggPFLGcZCC0oXgCVd+laTggUk8= Received: by 10.67.23.5 with SMTP id a5mr4105099ugj.1178439340381; Sun, 06 May 2007 01:15:40 -0700 (PDT) Received: from ?192.168.1.34? ( [82.2.140.214]) by mx.google.com with ESMTP id y37sm6972429iky.2007.05.06.01.15.33; Sun, 06 May 2007 01:15:38 -0700 (PDT) Message-ID: <463D8E91.4050605@enterprisedb.com> Date: Sun, 06 May 2007 09:15:13 +0100 From: Heikki Linnakangas User-Agent: Icedove 1.5.0.10 (X11/20070329) MIME-Version: 1.0 To: Yudhvir Singh Sidhu CC: pgsql-performance@postgresql.org Subject: Re: How to Find Cause of Long Vacuum Times - NOOB Question References: <463D0BD5.3010404@gmail.com> In-Reply-To: <463D0BD5.3010404@gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200705/62 X-Sequence-Number: 24452 Yudhvir Singh Sidhu wrote: > Versions: Postgresql version 8.09 on FreeBSD 6.1 > Situation: huge amounts of adds and deletes daily. Running daily vacuums > Problem: Vacuum times jump up from 45 minutes, or 1:30 minutes to 6+ > hours overnight, once every 1 to 3 months. > Solutions tried: db truncate - brings vacuum times down. Reindexing > brings vacuum times down. > > I know my indexes are getting fragmented and my tables are getting > fragmented. I also know that some of my btree indexes are not being used > in queries. I also know that using "UNIQUE" in a query makes PG ignore > any index. If the increase in vacuum time is indeed because of index fragmentation, upgrading to 8.2 might help. Since 8.2, we vacuum indexes in physical order, which speeds it up significantly, especially on fragmented indexes. -- Heikki Linnakangas EnterpriseDB http://www.enterprisedb.com