Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id D57441337B50 for ; Wed, 22 Sep 2010 01:10:15 -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 13695-02 for ; Wed, 22 Sep 2010 04:10:08 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from www.postnewspapers.com.au (www.postnewspapers.com.au [202.4.227.11]) by mail.postgresql.org (Postfix) with ESMTP id DDE2B1337B48 for ; Wed, 22 Sep 2010 01:10:07 -0300 (ADT) Received: from mail.postnewspapers.com.au (202-89-185-120.static.dsl.amnet.net.au [202.89.185.120]) by www.postnewspapers.com.au (Postfix) with ESMTP id B7A7DA2B4; Wed, 22 Sep 2010 12:10:03 +0800 (WST) Received: from localhost (localhost [127.0.0.1]) by mail.postnewspapers.com.au (Postfix) with ESMTP id 440FFAE47A; Wed, 22 Sep 2010 12:10:04 +0800 (WST) X-Virus-Scanned: Debian amavisd-new at postnewspapers.com.au Received: from mail.postnewspapers.com.au ([127.0.0.1]) by localhost (mail.postnewspapers.com.au [127.0.0.1]) (amavisd-new, port 10024) with LMTP id JUySqXepdBvy; Wed, 22 Sep 2010 12:09:58 +0800 (WST) Received: from [10.1.1.5] (124-148-245-78.dyn.iinet.net.au [124.148.245.78]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "Craig Ringer", Issuer "POST Certificate Authority" (verified OK)) by mail.postnewspapers.com.au (Postfix) with ESMTPSA id C3390AF4B2; Wed, 22 Sep 2010 12:09:49 +0800 (WST) Message-ID: <4C998184.2070402@postnewspapers.com.au> Date: Wed, 22 Sep 2010 12:09:40 +0800 From: Craig Ringer User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-GB; rv:1.9.1.12) Gecko/20100914 Thunderbird/3.0.8 MIME-Version: 1.0 To: Daniele Varrazzo CC: pgsql-performance@postgresql.org Subject: Re: Performance degradation, index bloat and planner estimates References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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: 201009/139 X-Sequence-Number: 40342 On 20/09/2010 7:59 PM, Daniele Varrazzo wrote: > Does anybody have some information about where the bloat is coming > from and what is the best way to get rid of it? Would a vacuum full > fix this kind of problem? Is there a way to fix it without taking the > system offline? It's hard to know where the index bloat comes from. The usual cause I see reported here is with regular VACUUM FULL use, which doesn't seem to be a factor in your case. A VACUUM FULL will not address index bloat; it's more likely to add to it. You'd want to use CLUSTER instead, but that'll still require an exclusive lock that takes the table offline for some time. Your current solution - a concurrent reindex - is your best bet for a workaround until you find out what's causing the bloat. If the bloat issue were with relations rather than indexes I'd suspect free space map issues as you're on 8.3. http://www.postgresql.org/docs/8.3/interactive/runtime-config-resource.html My (poor) understanding is that index-only bloat probably won't be an FSM issue. > The indexed condition is a state of the evolution of the records in > the table: many records assume that state for some time, then move to > a different state no more indexed. Is the continuous addition/deletion > of records to the index causing the bloat (which can be then > considered limited to the indexes with a similar usage pattern)? Personally I don't know enough to answer that. I would've expected that proper VACUUMing would address any resulting index bloat, but > Any idea of where the 20M record estimate is coming from? Isn't the > size of the partial index taken into account in the estimate? I'd really help to have EXPLAIN ANALYZE output here. -- Craig Ringer Tech-related writing at http://soapyfrogs.blogspot.com/