Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id F3593476913 for ; Thu, 12 Sep 2002 04:29:48 -0400 (EDT) Received: from news.hub.org (news.hub.org [64.49.215.80]) by postgresql.org (Postfix) with ESMTP id 793B94768B2 for ; Thu, 12 Sep 2002 04:29:48 -0400 (EDT) Received: by news.hub.org (Postfix, from userid 8) id AF25B38256C; Thu, 12 Sep 2002 04:29:47 -0400 (EDT) From: Mats Lofkvist X-Newsgroups: comp.databases.postgresql.admin Subject: Re: fsync or fdatasync Date: 12 Sep 2002 10:29:46 +0200 Organization: Hub.Org Networking Services (http://www.hub.org) Lines: 35 Message-ID: References: <200209101717.g8AHHuV29296@candle.pha.pa.us> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Complaints-To: news@hub.org User-Agent: Gnus/5.0803 (Gnus v5.8.3) Emacs/20.5 To: pgsql-admin@postgresql.org X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200209/136 X-Sequence-Number: 5675 pgman@candle.pha.pa.us (Bruce Momjian) writes: > Ragnar Kjørstad wrote: > > On Tue, Sep 10, 2002 at 11:40:24AM -0400, Bruce Momjian wrote: > > > > > > The original poster was wrong about the default. > > > > > > We use fdatasync where available, and fsync when it is not. > > > > Makes sense. > > > > > We also use > > > O_SYNC on open if it is available. > > > > Why? That will slow tings down... > > Actually, no, we are only O_SYNC'ing the WAL writes and sometimes that > is faster because you are not writing then fsyncing, you are just > writing. The fdatasync only is better than O_SYNC when you are doing > multiple WAL writes before an fdatasync and we normally don't do that. > I may be wrong on this, but my understanding is that the difference between fsync() and O_SYNC on the one hand and fdatasync() and O_DSYNC on the other hand is that the latter don't have to sync metadata (e.g. file access times) which saves a write to the inode that is more or less guarantied to require an extra seek. Iff this is true you never want to use fsync() or O_SYNC when fdatasync() and O_DSYNC is available (unless you really need the metadata to be synced too). _ Mats Lofkvist mal@algonet.se