Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id BB48FB6236C for ; Fri, 3 Jun 2011 14:03:56 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 95777-05 for ; Fri, 3 Jun 2011 17:03:45 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from lo.gmane.org (lo.gmane.org [80.91.229.12]) by mail.postgresql.org (Postfix) with ESMTP id 975DAB624A5 for ; Fri, 3 Jun 2011 14:03:45 -0300 (ADT) Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1QSXmi-0005Wm-4p for pgsql-admin@postgresql.org; Fri, 03 Jun 2011 19:03:44 +0200 Received: from frigga.summersault.com ([12.161.105.138]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 03 Jun 2011 19:03:44 +0200 Received: from mark by frigga.summersault.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 03 Jun 2011 19:03:44 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: pgsql-admin@postgresql.org From: Mark Stosberg Subject: Re: surprised to find bloat in insert-only table Date: Fri, 03 Jun 2011 13:03:31 -0400 Lines: 31 Message-ID: References: <28332.1307116922@sss.pgh.pa.us> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: frigga.summersault.com User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.14) Gecko/20110223 Thunderbird/3.1.8 In-Reply-To: <28332.1307116922@sss.pgh.pa.us> X-Enigmail-Version: 1.1.1 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-10 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201106/18 X-Sequence-Number: 37644 Thanks for reply, Tom. > It's hard to evaluate that without knowing what the actual table/index > sizes are, or IOW what is the reported bloat on a percentage basis? The table size is reported as: 4036 MB according to: select pg_size_pretty(pg_table_size('table_name')); Compared to 1669 MB reported as table bloat in the 'bloat' view. So, the bloat is about 40% of the total size. For an index, it's 410 MB of bloat, vs 1669 MB for an index size. One thing that looks suspicious is that the exact same number of bytes is being report for the table as well as each index. > The view you mention isn't tremendously accurate --- AFAICS it isn't > accounting for alignment padding between fields, page headers, and some > other things. And it will consider the unused space on a page to be > "bloat" even if it's too small to fit another tuple. So expecting the > number to be zero is hopelessly optimistic. Also, indexes generally > don't even try to pack pages completely full, so a larger percentage of > unused space is to be expected for them. Thanks for the clarifications! In summary, it sounds like there is some bloat that I need to live with, but at least with partitioning the amount of bloat will stay relatively constant. Mark