Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 5655D635349 for ; Fri, 11 Jun 2010 11:54:36 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 78312-04 for ; Fri, 11 Jun 2010 14:54:29 +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 E40A16338CF for ; Fri, 11 Jun 2010 11:54:28 -0300 (ADT) Received: from mh5.mail.rice.edu (localhost.localdomain [127.0.0.1]) by mh5.mail.rice.edu (Postfix) with ESMTP id 0882B15C026; Fri, 11 Jun 2010 09:54:27 -0500 (CDT) X-Virus-Scanned: by amavis-2.6.0 at mh5.mail.rice.edu Received: from mh5.mail.rice.edu ([127.0.0.1]) by mh5.mail.rice.edu (mh5.mail.rice.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id h-0j6NF6ALoj; Fri, 11 Jun 2010 09:54:26 -0500 (CDT) Received: from aart.is.rice.edu (aart.is.rice.edu [168.7.56.48]) by mh5.mail.rice.edu (Postfix) with ESMTP id D3EFF15C002; Fri, 11 Jun 2010 09:54:26 -0500 (CDT) Received: by aart.is.rice.edu (Postfix, from userid 18612) id BD8932D5A6; Fri, 11 Jun 2010 09:54:26 -0500 (CDT) Date: Fri, 11 Jun 2010 09:54:26 -0500 From: Kenneth Marshall To: dx k9 Cc: posgres support Subject: Re: check_postgres_bloat Message-ID: <20100611145426.GU3063@aart.is.rice.edu> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.16 (2007-06-09) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.311 tagged_above=-10 required=5 tests=BAYES_40=-0.001, RCVD_IN_DNSWL_MED=-2.3, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201006/99 X-Sequence-Number: 34877 On Fri, Jun 11, 2010 at 10:50:20AM -0400, dx k9 wrote: > > Hi, > > > > I'm running a the check_postgres.pl --action=bloat on a database and finding that there is wasted space. > > > > I'm using 95% for the crtical %. If I use 110% I get the same things, but 115% shows everything is OK. > > > > check_postgres_bloat -H host -p port -db thing -t thing1 -c 95% > > check_postgres.pl version 2.14.3 > > postgres version 8.3.9 > > > > > > POSTGRES_BLOAT CRITICAL: service=thing1 (db thing) table public.thing1 rows:25537152 pages:212311 shouldbe:187545 (1.1X) wasted size:202883072 (193 MB) * (db thing) table public.thing2 rows:10109173 pages:101832 shouldbe:94016 (1.1X) wasted size:64028672 (61 MB) * (db thing) table thing3 rows:1184946 pages:28701 shouldbe:21434 (1.3X) wasted size:59531264 (56 MB) * > > > I have run a reindexdb on the table, full vacuum (fze), still I can't get the wasted size to go down on these, so I continue to get critical alerts that my tables are bloated. > > check_postgres checks for both index and table bloat. It looks like my indexes are ok, this is just picking up on table bloat. I'm not sure what I can do to reclaim the wasted space other than vacuum full & analyze. Maybe a pgdump will do it. > > Thanks for any insight, > ~DjK > Because of the way PostgreSQL performs updates, your database will perform better with a little bit of extra space over the amount needed for your data. Unless you have a read-only database, just use normal vacuum via autovacuum and forget about vacuum full and trying to get "wasted" space to zero. Regards, Ken