Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id D24139FA502 for ; Mon, 25 Sep 2006 18:11:12 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 57350-09 for ; Mon, 25 Sep 2006 18:11:08 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.logix-tt.com (mail.logix-tt.com [212.211.145.186]) by postgresql.org (Postfix) with ESMTP id 85A2A9FA376 for ; Mon, 25 Sep 2006 18:11:07 -0300 (ADT) Received: from kingfisher.intern.logix-tt.com (p549D2185.dip0.t-ipconnect.de [84.157.33.133]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.logix-tt.com (Postfix) with ESMTP id 3B778656BE; Mon, 25 Sep 2006 23:13:28 +0200 (CEST) Received: from [127.0.0.1] (localhost [127.0.0.1]) by kingfisher.intern.logix-tt.com (Postfix) with ESMTP id C0BB6181AC330; Mon, 25 Sep 2006 23:11:08 +0200 (CEST) Message-ID: <451845EC.3020506@logix-tt.com> Date: Mon, 25 Sep 2006 23:11:08 +0200 From: Markus Schaber Organization: Logical Tracking and Tracing International AG, Switzerland User-Agent: Thunderbird 1.5.0.5 (X11/20060812) MIME-Version: 1.0 To: Marc Morin Cc: pgsql-performance@postgresql.org Subject: Re: Decreasing BLKSZ References: <2BCEB9A37A4D354AA276774EE13FB8C201130680@mailserver.sandvine.com> In-Reply-To: <2BCEB9A37A4D354AA276774EE13FB8C201130680@mailserver.sandvine.com> X-Enigmail-Version: 0.94.0.0 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.2 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200609/331 X-Sequence-Number: 21017 Hi, Marc, Marc Morin wrote: > The problem is, the insert pattern has low correlation with the > (key,logtime) index. In this case, would need >1M blocks in my > shared_buffer space to prevent a read-modify-write type of pattern > happening during the inserts (given a large enough database). Would it be possible to change the primary key to (logtime,key)? This could help keeping the "working window" small. Secondly, the real working set is smaller, as the rows are all inserted at the end of the table, filling each page until it's full, so only the last pages are accessed. There's no relation between the index order, and the order of data on disk, unless you CLUSTER. > Any comment on other affects or gotchas with lowering the size of > BLKSZ? Currently, our database is thrashing its cache of blocks we > we're getting only ~100 inserts/second, every insert results in a > evict-read-modify operation. I'm not shure that's the correct diagnosis. Do you have one transaction per insert? Every transaction means a forced sync to the disk, so you won't get more than about 100-200 commits per second, depending on your actual disk rotation speed. To improve concurrency of the "numer of inserters" running in parallel, try to tweak the config variables commit_delay and commit_sibling, so you get a higher overall throughput at cost of an increased delay per connection, and increase the number of inserters. Using sensible tweaking, the throughput should scale nearly linear with the number of backens. :-) If feasible for your application, you can also bundle several log entries into a single transaction. If you're CPU bound, you can use COPY instead of INSERT or (if you can wait for 8.2) the new multi-row INSERT to further improve performance, but I doubt that you're CPU bound. The only way to "really" get over the sync limit is to have (at least) the WAL on a battery backed ram / SSD media that has no "spinning disk" physical limit, or abandon crash safety by turning fsync off. Thanks, Markus. -- Markus Schaber | Logical Tracking&Tracing International AG Dipl. Inf. | Software Development GIS Fight against software patents in Europe! www.ffii.org www.nosoftwarepatents.org