pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bruce Momjian <pgman@candle.pha.pa.us>
To: Mats Lofkvist <mal@algonet.se>
Cc: pgsql-admin@postgresql.org
Subject: Re: fsync or fdatasync
Date: Thu, 12 Sep 2002 12:25:38 -0400 (EDT)
Message-ID: <200209121625.g8CGPcf04332@candle.pha.pa.us> (raw)
In-Reply-To: <y2q7khr626d.fsf@algonet.se>

Mats Lofkvist wrote:
> > 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).

Yes, I didn't mention O_DSYNC.  It is in the cards.  If you are
interested, look at the code and how the defaults are chosen.

postgresql.conf say:

#wal_sync_method = fsync        # the default varies across platforms:
#                               # fsync, fdatasync, open_sync, or open_datasync

Which means exactly that, varies based on the platform.

-- 
  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



view thread (26+ messages)  latest in thread

Message-ID: <200209121625.g8CGPcf04332@candle.pha.pa.us>
Permalink:  ../200209121625.g8CGPcf04332@candle.pha.pa.us/
Also on:    postgresql.org/message-id/200209121625.g8CGPcf04332@candle.pha.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: pgman@candle.pha.pa.us, mal@algonet.se
  Subject: Re: fsync or fdatasync
  In-Reply-To: <200209121625.g8CGPcf04332@candle.pha.pa.us>
  References: <y2q7khr626d.fsf@algonet.se> <200209121625.g8CGPcf04332@candle.pha.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox