Received: from localhost (maia-1.hub.org [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id CF29E9FB9E6 for ; Tue, 8 May 2007 09:40:32 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-maia, port 10024) with ESMTP id 74692-03 for ; Tue, 8 May 2007 09:40:29 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.5 Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.175]) by postgresql.org (Postfix) with ESMTP id 213509FB97F for ; Tue, 8 May 2007 09:40:28 -0300 (ADT) Received: by ug-out-1314.google.com with SMTP id k3so73743ugf for ; Tue, 08 May 2007 05:40:27 -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=NrmgKeuQHkA0tbDYuou8UlPWBBExnbaWxn43oaSCzmecwoddhtecRIQiU3EhpeU0TkdmssBINYe+8sIpqGIHxe8OmDNbmFoGjHB1Vb3EmruN/1qh4FBN6rXa0Pce6LbD5cBvYtHe8ojbMazEgKBSDaqDnzrgJC+x6nje6dbfWUg= 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=o0Y8mokIrZOK74Ax+Wa/1btbyk4Ksda6ZPz+iuyMQJ6XqW9f/yBAnsqBuNFRhM2TrmRf8VgKp44faG1gccD4zprRosv4Mg5xTbTS18Y3Zwhc6HOKCcU81TKhNlvrAHn+nSIEKE/U2YXlh8nDiQEqmZBEoaWxsHM66vj0/R5KZlY= Received: by 10.67.6.1 with SMTP id j1mr435940ugi.1178628027619; Tue, 08 May 2007 05:40:27 -0700 (PDT) Received: from ?172.24.32.83? ( [62.232.55.118]) by mx.google.com with ESMTP id i39sm790829ugd.2007.05.08.05.40.26; Tue, 08 May 2007 05:40:26 -0700 (PDT) Message-ID: <46406FA5.3080907@enterprisedb.com> Date: Tue, 08 May 2007 13:40:05 +0100 From: Heikki Linnakangas User-Agent: Icedove 1.5.0.10 (X11/20070329) MIME-Version: 1.0 To: Guillaume Cottenceau CC: pgsql-performance@postgresql.org Subject: Re: estimating the need for VACUUM FULL and REINDEX References: <87odkvmsav.fsf@meuh.mnc.lan> In-Reply-To: <87odkvmsav.fsf@meuh.mnc.lan> 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/115 X-Sequence-Number: 24505 Guillaume Cottenceau wrote: > According to documentation[1], VACUUM FULL's only benefit is > returning unused disk space to the operating system; am I correct > in assuming there's also the benefit of optimizing the > performance of scans, because rows are physically compacted on > the disk? That's right. > With that in mind, I've tried to estimate how much benefit would > be brought by running VACUUM FULL, with the output of VACUUM > VERBOSE. However, it seems that for example the "removable rows" > reported by each VACUUM VERBOSE run is actually reused by VACUUM, > so is not what I'm looking for. Take a look at contrib/pgstattuple. If a table has high percentage of free space, VACUUM FULL will compact that out. > Then according to documentation[2], REINDEX has some benefit when > all but a few index keys on a page have been deleted, because the > page remains allocated (thus, I assume it improves index scan > performance, am I correct?). However, again I'm unable to > estimate the expected benefit. With a slightly modified version > of a query found in documentation[3] to see the pages used by a > relation[4], I'm able to see that the index data from a given > table... See pgstatindex, in the same contrib-module. The number you're looking for is avg_leaf_density. REINDEX will bring that to 90% (with default fill factor), so if it's much lower than that REINDEX will help. -- Heikki Linnakangas EnterpriseDB http://www.enterprisedb.com