Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id C113F1337B69 for ; Mon, 4 Apr 2011 13:32:54 -0300 (ADT) 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 51747-09 for ; Mon, 4 Apr 2011 16:32:47 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id 6C2BF1337B68 for ; Mon, 4 Apr 2011 13:32:47 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id p34GWk1t001425; Mon, 4 Apr 2011 12:32:46 -0400 (EDT) To: Glyn Astill cc: Kenneth Marshall , pgsql-admin@postgresql.org Subject: Re: Bloated indexes from pg_restore? (Was: Index fillfactor changed in pg9?) In-reply-to: <736208.74368.qm@web26007.mail.ukl.yahoo.com> References: <736208.74368.qm@web26007.mail.ukl.yahoo.com> Comments: In-reply-to Glyn Astill message dated "Mon, 04 Apr 2011 17:23:40 +0100" Date: Mon, 04 Apr 2011 12:32:46 -0400 Message-ID: <1424.1301934766@sss.pgh.pa.us> From: Tom Lane 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: 201104/40 X-Sequence-Number: 37221 Glyn Astill writes: > --- On Mon, 4/4/11, Tom Lane wrote: >>> So it appears now that if I restore the database using >>> pg_restore, I end up with bloated indexes, which are fixed >>> with a vacuum full. >>> >>> The dump is a data only dump with the -Fc flag, >> Data only dump?  Then what is the state of the >> database you're restoring it into? > It's a newly created database from a schema only dump. So the difference is that you have initially-empty indexes that are filled incrementally, whereas an ordinary dump-and-restore would be creating fresh indexes. Incremental filling of a btree is usually said to result in about 66% fillfactor on average, 50% worst-case; whereas by default I think we build fresh indexes at 90% fillfactor. You didn't say how much "bloat" you were seeing, but if it's less than 2X I think this is just expected. Unless the data is pretty static, it's useless to hope that the fill factor will stay as high as 90% anyway. regards, tom lane