Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 63CD5B5DBD3 for ; Mon, 23 May 2011 15:49:12 -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 26873-07 for ; Mon, 23 May 2011 18:49:04 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail.gransy.com (mail.gransy.com [82.208.29.194]) by mail.postgresql.org (Postfix) with ESMTP id A33BEB5DBD2 for ; Mon, 23 May 2011 15:49:03 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by mail.gransy.com (Postfix) with ESMTP id CAFDB3681B0 for ; Mon, 23 May 2011 20:49:02 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at nathalia.gransy.com Received: from mail.gransy.com ([127.0.0.1]) by localhost (Nathalka.gransy.com.gransy.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id V1vVNxpbkjlX for ; Mon, 23 May 2011 20:49:02 +0200 (CEST) Received: from [192.168.1.221] (ip-94-112-0-189.net.upcbroadband.cz [94.112.0.189]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.gransy.com (Postfix) with ESMTPSA id 566243681C7 for ; Mon, 23 May 2011 20:46:38 +0200 (CEST) Message-ID: <4DDAAB8F.5030508@fuzzy.cz> Date: Mon, 23 May 2011 20:46:39 +0200 From: Tomas Vondra User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.13) Gecko/20101219 Lightning/1.0b3pre Thunderbird/3.1.7 MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Re: Performance degradation of inserts when database size grows References: <4DDA617A.6090105@peak6.com> In-Reply-To: <4DDA617A.6090105@peak6.com> X-Enigmail-Version: 1.1.1 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-10 required=5 tests=BAYES_00=-1.9 X-Spam-Level: X-Archive-Number: 201105/307 X-Sequence-Number: 43816 Dne 23.5.2011 15:30, Shaun Thomas napsal(a): > On 05/17/2011 07:45 AM, Andrey Vorobiev wrote: > >> 2011-05-17 18:55:51 NOVST LOG: checkpoint starting: xlog >> 2011-05-17 18:57:20 NOVST LOG: checkpoint complete: wrote 62861 buffers >> (24.0%); 0 transaction log file(s) added, 0 removed, 0 recycled; >> write=89.196 s, sync=0.029 s, total=89.242 s > > Increase your checkpoint_segments. If you see "checkpoint starting: > xlog" instead of "checkpoint starting: time", you don't have enough > checkpoint segments to handle your writes. Checkpoints *will* degrade > your throughput. > Really? He already has 64 checkpoint segments, which is about 1GB of xlog data. The real problem is that the amount of buffers to write is constantly growing. At the beginning there's 62861 buffers (500MB) and at the end there's 137657 buffers (1GB). IMHO increasing the number of checkpoint segments would make this disruption even worse. What I don't understand is that the checkpoint time does not increase with the amount of data to write. Writing the 62861 buffers total=89.242 s ( 5 MB/s) 83747 buffers total=75.061 s ( 9 MB/s) 97341 buffers total=60.479 s (13 MB/s) 110149 buffers total=52.379 s (17 MB/s) 120003 buffers total=46.864 s (20 MB/s) 122296 buffers total=57.867 s (17 MB/s) 128165 buffers total=55.188 s (18 MB/s) 138508 buffers total=58.068 s (19 MB/s) 132485 buffers total=73.047 s (14 MB/s) 139542 buffers total=68.319 s (16 MB/s) 137657 buffers total=84.640 s (13 MB/s) Maybe this depends on what sections of the files are modified (contiguous vs. not contiguous), but I doubt it. In 9.1 there's a feature that spreads checkpoint writes, but with 8.4 that's not possible. I think think this might be tuned using background writer, just make it more aggressive. - bgwriter_delay (decrease) - bgwriter_lru_maxpages (increase) - bgwriter_lru_multiplier (increase) regards Tomas