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 BE28352BDC for ; Mon, 25 Jul 2005 21:52:02 -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 41807-09 for ; Tue, 26 Jul 2005 00:51:51 +0000 (GMT) Received: from mail.Mi8.com (mail.mi8.com [63.240.6.50]) by svr1.postgresql.org (Postfix) with ESMTP id 6414852BB6 for ; Mon, 25 Jul 2005 21:51:50 -0300 (ADT) Received: from 172.16.1.118 by mail.Mi8.com with ESMTP (- GW05 Welcome to Mi8 Corporation www.Mi8.com); Mon, 25 Jul 2005 20:51:49 -0400 X-Server-Uuid: E0C866E6-C6CD-48B5-AE61-E57E73CF3CC7 Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.175]) by d01smtp03.Mi8.com with Microsoft SMTPSVC(6.0.3790.1830); Mon, 25 Jul 2005 20:51:49 -0400 Received: from 67.103.45.218 ([67.103.45.218]) by MI8NYCMAIL06.Mi8.com ( [172.16.1.219]) via Exchange Front-End Server mi8owa.mi8.com ( [172.16.1.104]) with Microsoft Exchange Server HTTP-DAV ; Mon, 25 Jul 2005 20:51:48 -0500 User-Agent: Microsoft-Entourage/11.1.0.040913 Date: Mon, 25 Jul 2005 17:51:48 -0700 Subject: Re: "Vacuum Full Analyze" taking so long From: "Luke Lonergan" To: "John A Meinel" , "Tomeh, Husam" Cc: pgsql-performance@postgresql.org Message-ID: In-Reply-To: <42E5763C.7030804@arbash-meinel.com> MIME-Version: 1.0 X-OriginalArrivalTime: 26 Jul 2005 00:51:49.0530 (UTC) FILETIME=[34A79FA0:01C5917C] X-WSS-ID: 6EFB56AF1M812745206-01-01 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.576 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO, RCVD_NUMERIC_HELO X-Spam-Level: * X-Archive-Number: 200507/377 X-Sequence-Number: 13618 Husam, On 7/25/05 4:31 PM, "John A Meinel" wrote: > Tomeh, Husam wrote: >> >> Nothing was running except the job. The server did not look stressed out >> looking at top and vmstat. We have seen slower query performance when >> performing load tests, so I run the re-index on all application indexes >> and then issue a full vacuum. I ran the same thing on a staging server >> and it took less than 12 hours. Is there a possibility the DB pages are >> corrupted. Is there a command to verify that. (In Oracle, there's a >> dbverify command that checks for corruption on the data files level). >> >> 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?? > > I *think* if you are planning on dropping the indexes anyway, just drop > them, VACUUM ANALYZE, and then recreate them, I don't think you have to > re-analyze after you have recreated them. I agree - and don't run "VACUUM FULL", it is quite different from "VACUUM". Also - you should only need to vacuum if you've deleted a lot of data. It's job is to reclaim space lost to rows marked deleted. So, in fact, you may not even need to run VACUUM. "VACUUM FULL" is like a disk defragmentation operation within the DBMS, and is only necessary if there is a slowdown in performance from lots and lots of deletes and/or updates and new data isn't finding sequential pages for storage, which is rare. Given the need for locking, it's generally better to dump and restore in that case, but again it's a very rare occasion. I don't know of a command to check for page corruption, but I would think that if you can run VACUUM (not full) you should be OK. - Luke