Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 7A2E4133655C for ; Tue, 30 Nov 2010 14:41:13 -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 65783-02 for ; Tue, 30 Nov 2010 18:41:06 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mh5.mail.rice.edu (mh5.mail.rice.edu [128.42.199.32]) by mail.postgresql.org (Postfix) with ESMTP id 331471335B36 for ; Tue, 30 Nov 2010 14:41:06 -0400 (AST) Received: from mh5.mail.rice.edu (localhost.localdomain [127.0.0.1]) by mh5.mail.rice.edu (Postfix) with ESMTP id E49FF28F75D; Tue, 30 Nov 2010 12:41:05 -0600 (CST) X-Virus-Scanned: by amavis-2.6.4 at mh5.mail.rice.edu, auth channel Received: from mh5.mail.rice.edu ([127.0.0.1]) by mh5.mail.rice.edu (mh5.mail.rice.edu [127.0.0.1]) (amavis, port 10026) with ESMTP id l8EaY3CYUOOE; Tue, 30 Nov 2010 12:41:05 -0600 (CST) X-SMTP-Auth: no X-SMTP-Auth: no Received: from aart.is.rice.edu (aart.is.rice.edu [168.7.56.48]) by mh5.mail.rice.edu (Postfix) with ESMTP id B573628F755; Tue, 30 Nov 2010 12:41:05 -0600 (CST) Received: by aart.is.rice.edu (Postfix, from userid 18612) id D46F72D5A6; Tue, 30 Nov 2010 12:41:03 -0600 (CST) Date: Tue, 30 Nov 2010 12:41:03 -0600 From: Kenneth Marshall To: Shridhar Polas Cc: pgsql-admin@postgresql.org Subject: Re: Space occupied by Postgres index. Message-ID: <20101130184103.GM19162@aart.is.rice.edu> References: <00b901cb90b3$ca9ddc40$5fd994c0$@gmail.com> <20101130172841.GK19162@aart.is.rice.edu> <00c301cb90b5$f54b6370$dfe22a50$@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <00c301cb90b5$f54b6370$dfe22a50$@gmail.com> User-Agent: Mutt/1.5.16 (2007-06-09) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-4.21 tagged_above=-10 required=5 tests=BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201011/261 X-Sequence-Number: 36227 A regular vacuum will free space reclaimed at the end of a table. In normal use, your optimum space consumption is that needed to hold the current table data plus the space needed to hold the old deleted or modified data until a regular vacuum can make it available for reuse. In addition, using HOT updates with table fillfactor < 100, can greatly reduce table fragmentation and bloating. Cheers, Ken On Tue, Nov 30, 2010 at 11:12:23PM +0530, Shridhar Polas wrote: > Thanks for a quick response Ken. > > One more query:- > > If I do not perform VACUUM FULL and REINDEX, does Postgres reclaimed the > space automatically when number of records in tables reduce after touching > some limit? I mean the total disk space consumed by Postgres would ever be > decline at any point without performing VACUUM FULL and REINDEX? > > In my test setup I found that the disk space consumed by Postgers is not > getting declined even after deleting records from tables, if I do not > perform VACUUM FULL and REINDEX. > > Thanks again > Shridhar > > -----Original Message----- > From: Kenneth Marshall [mailto:ktm@rice.edu] > Sent: Tuesday, November 30, 2010 10:59 PM > To: Shridhar Polas > Cc: pgsql-admin@postgresql.org > Subject: Re: [ADMIN] Space occupied by Postgres index. > > On Tue, Nov 30, 2010 at 10:56:53PM +0530, Shridhar Polas wrote: > > Hi, > > > > > > > > I am facing a problem where indexes creates on some tables are > > occupying huge space on disk and it seems to me that this space is not > > getting reclaimed even when there are very few record in an associated > table. > > > > > > > > When I ran full vacuum the disk space was reclaimed occupied by tables > > but not by disk space occupied by indexes. > > > > > > > > Can somebody please tell me when disk space occupied by Postgres index > > is reclaimed, without performing re-indexing on those tables? > > > > > > > > Thanks, > > > > Shridhar > > > > VACUUM FULL will cause index bloat. You will need to REINDEX to recover the > space. Note, you should not really need to use VACUUM FULL in a normal > correctly configured system. > > Cheers, > Ken > >