Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 730471337B39 for ; Tue, 1 Feb 2011 15:24:59 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 11511-10 for ; Tue, 1 Feb 2011 19:24:48 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.17.8]) by mail.postgresql.org (Postfix) with ESMTP id B30D3133616B for ; Tue, 1 Feb 2011 15:24:47 -0400 (AST) Received: from [192.168.1.6] (mail.highperformancepostgresql.com [71.179.240.8]) by mrelayeu.kundenserver.de (node=mreu2) with ESMTP (Nemesis) id 0LmPME-1QKEpA1EcU-00a83R; Tue, 01 Feb 2011 20:24:47 +0100 Message-ID: <4D485DFC.4090808@2ndquadrant.com> Date: Tue, 01 Feb 2011 14:24:44 -0500 From: Greg Smith User-Agent: Thunderbird 2.0.0.24 (X11/20100317) MIME-Version: 1.0 To: mladen.gogala@vmsinfo.com CC: "pgsql-performance@postgresql.org" Subject: Re: Any experience using "shake" defragmenter? References: <4D45C607.4070101@vmsinfo.com> In-Reply-To: <4D45C607.4070101@vmsinfo.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: V02:K0:WOCMkakZXlb2xXmjonMli/LQVEAtTsYGCRHUfUi3nn5 hnBS8x3FICkZ7ywan7B75t5vgiazIBqDWwHg6ajTYJt6nfPjcA nId014LKHm/49yC0nWiM3BhqSYmzx4Ok9w8RqW206gd1NCX6A0 3DQnPVEBb7LmmfpAAcI42q2sr/M6nTkxTMksrnGsHMeblNOUsQ pE0X8MnzVxAKHzvulPs9dVu3hmzCEoSOfvgVtP6iAg= X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-10 required=5 tests=BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001 X-Spam-Level: X-Archive-Number: 201102/7 X-Sequence-Number: 42145 Mladen Gogala wrote: > Did anyone try using "shake" while the cluster is active? Any problems > with corruption or data loss? I ran the thing on my home directory and > nothing was broken. I didn't develop any performance test, so cannot > vouch for the effectiveness of the procedure. Did anyone play with > that? Any positive or negative things to say about shake? > Shake works by allocating a new file the size of the original, in what is presumed to be then be unfragmented space. It copies the original over to this new space and then gets rid of the original. That procedure will cause database corruption if the server happens to access the file it's moving while it's in the middle of doing so. If the database isn't running, though, it is probably fine. On ext3 you can measure whether it was useful or not by taking the filesystem off-line and running fsck before/after using it. Look for percentages given for "non-contiguous files" and directories. If those were low to begin with, little reason to run the utility. If they're high, running shake should bring them down afterwards if it's doing its job right. On a PostgreSQL database system, you can get the same basic effect while leaving the server up--but just with the table locked--using CLUSTER. And that will clean up a bunch of other potential messes inside the database that shake can't touch. I just do that instead if I'm worried a particular table has become fragmented on disk. -- Greg Smith 2ndQuadrant US greg@2ndQuadrant.com Baltimore, MD PostgreSQL Training, Services, and 24x7 Support www.2ndQuadrant.us "PostgreSQL 9.0 High Performance": http://www.2ndQuadrant.com/books