X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id CAEB4329D28 for ; Tue, 14 Sep 2004 02:28:21 +0100 (BST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 35065-09 for ; Tue, 14 Sep 2004 01:28:14 +0000 (GMT) Received: from candle.pha.pa.us (candle.pha.pa.us [207.106.42.251]) by svr1.postgresql.org (Postfix) with ESMTP id A35EF329C82 for ; Tue, 14 Sep 2004 02:28:13 +0100 (BST) Received: (from pgman@localhost) by candle.pha.pa.us (8.11.6/8.11.6) id i8E1S9i04905; Mon, 13 Sep 2004 21:28:09 -0400 (EDT) From: Bruce Momjian Message-Id: <200409140128.i8E1S9i04905@candle.pha.pa.us> Subject: Re: Determine optimal fdatasync/fsync, O_SYNC/O_DSYNC options In-Reply-To: <24308.1095110306@sss.pgh.pa.us> To: Tom Lane Date: Mon, 13 Sep 2004 21:28:09 -0400 (EDT) Cc: Gaetano Mendola , pgsql-performance@postgresql.org X-Mailer: ELM [version 2.4ME+ PL108 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200409/99 X-Sequence-Number: 8227 Tom Lane wrote: > The tests that started this thread are pretty unconvincing in my eyes, > because they are comparing open_sync against code that fsyncs after each > one-block write. Under those circumstances, *of course* fsync will lose > (or at least do no better), because it's forcing the same number of > writes through a same-or-less-efficient API. The reason that this isn't > a trivial choice is that Postgres doesn't necessarily need to fsync > after every block of WAL. In particular, when doing large transactions > there could be many blocks written between fsyncs, and in that case you > could come out ahead with fsync because the kernel would have more > freedom to schedule disk writes. My guess is that the majority of queries do not fill more than one WAL block. Sure some do, but in those cases the fsync is probably small compared to the duration of the query. If we had a majority of queries filling more than one block we would be checkpointing like crazy and we don't normally get reports about that. -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073