Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WZpvp-0005vT-7n for pgsql-hackers@arkaria.postgresql.org; Mon, 14 Apr 2014 23:04:53 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1WZpvo-0002OY-Ij for pgsql-hackers@arkaria.postgresql.org; Mon, 14 Apr 2014 23:04:52 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WZpvn-0002OP-D8 for pgsql-hackers@postgresql.org; Mon, 14 Apr 2014 23:04:51 +0000 Received: from 99-153-64-76.uvs.austtx.sbcglobal.net ([99.153.64.76] helo=noel.decibel.org) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WZpvl-0001r8-3U for pgsql-hackers@postgresql.org; Mon, 14 Apr 2014 23:04:50 +0000 Received: from decina.local (rrcs-67-79-71-90.sw.biz.rr.com [67.79.71.90]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by noel.decibel.org (Postfix) with ESMTPSA id 59B8F6D48C; Mon, 14 Apr 2014 23:04:48 +0000 (UTC) Message-ID: <534C6985.6060406@nasby.net> Date: Mon, 14 Apr 2014 18:04:37 -0500 From: Jim Nasby User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 MIME-Version: 1.0 To: Joe Conway , Andres Freund CC: "Hackers (PostgreSQL)" Subject: Re: Excessive WAL generation and related performance issue References: <534C540F.4030905@joeconway.com> <20140414215059.GA4161@awork2.anarazel.de> <534C5E6E.1080604@nasby.net> <534C667D.2000505@joeconway.com> In-Reply-To: <534C667D.2000505@joeconway.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -0.9 (/) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org On 4/14/14, 5:51 PM, Joe Conway wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > On 04/14/2014 03:17 PM, Jim Nasby wrote: >> On 4/14/14, 4:50 PM, Andres Freund wrote: >>> On 2014-04-14 14:33:03 -0700, Joe Conway wrote: >>>> I realize there are many things that can be done to improve my >>>> specific scenario, e.g. drop indexes before loading, change >>>> various configs, etc. My purpose for this post is to ask if it >>>> is really expected to get over 20 times as much WAL as heap >>>> data? >>> >>> I'd bet a large percentage of this will be full page images of >>> the index. The values you index are essentially distributed over >>> the whole index, so you'll modifiy the same indx values >>> repeatedly. But often enough it won't be in the same checkpoint >>> and thus will create full page images. >> >> My thought exactly... >> >> ISTM that we should be able to push all the index inserts to the >> end of the transaction. That should greatly reduce the amount of >> full page writes. That would also open the door for doing all the >> index inserts in parallel. > > That's the thing. I'm sure there is tuning and other things to improve > this particular case, but creating over 20 times as much WAL as real > data seems like pathological behavior to me. Can you take a look at what's actually going into WAL when the wheels fall off? I think it should be pretty easy to test the theory that it's a ton of full page writes of index leaf pages... -- Jim C. Nasby, Data Architect jim@nasby.net 512.569.9461 (cell) http://jim.nasby.net -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers