X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id ED96952EAD for ; Tue, 26 Jul 2005 06:58:28 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 60078-06 for ; Tue, 26 Jul 2005 09:58:24 +0000 (GMT) Received: from mailservice.tudelft.nl (mailservice.tudelft.nl [130.161.131.5]) by svr1.postgresql.org (Postfix) with ESMTP id C8B5F52EF2 for ; Tue, 26 Jul 2005 06:58:19 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by rav.antivirus (Postfix) with ESMTP id CC1F080184 for ; Tue, 26 Jul 2005 11:58:21 +0200 (CEST) Received: from [130.161.3.219] (oli219.office.oli.tudelft.nl [130.161.3.219]) by mx4.tudelft.nl (Postfix) with ESMTP id 0F29380183 for ; Tue, 26 Jul 2005 11:58:21 +0200 (CEST) Message-ID: <42E60939.9010905@oli.tudelft.nl> Date: Tue, 26 Jul 2005 11:58:17 +0200 From: Jochem van Dieten Organization: OnLine Internet User-Agent: Mozilla Thunderbird 1.0.5 (Windows/20050711) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Re: "Vacuum Full Analyze" taking so long References: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at tudelft.nl X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200507/380 X-Sequence-Number: 13621 Tomeh, Husam wrote: > The other question I have. What would be the proper approach to rebuild > indexes. I re-indexes and then run vacuum/analyze. Should I not use the > re-index approach, and instead, drop the indexes, vacuum the tables, and > then create the indexes, then run analyze on tables and indexes?? If you just want to rebuild indexes, just drop and recreate. However, you are also running a VACUUM FULL, so I presume you have deleted a significant number of rows and want to recover the space that was in use by them. In that scenario, it is often better to CLUSTER the table to force a rebuild. While VACUUM FULL moves the tuples around inside the existing file(s), CLUSTER simply creates new file(s), moves all the non-deleted tuples there and then swaps the old and the new files. There can be a significant performance increase in doing so (but you obviously need to have some free diskspace). If you CLUSTER your table it will be ordered by the index you specify. There can be a performance increase in doing so, but if you don't want to you can also do a no-op ALTER TABLE and change a column to a datatype that is the same as it already has. This too will force a rewrite of the table but without ordering the tuples. So in short my recommendations: - to rebuild indexes, just drop and recreate the indexes - to rebuild everything because there is space that can bepermanently reclaimed, drop indexes, cluster or alter the table, recreate the indexes and anlyze the table Jochem