pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bruce Momjian <pgman@candle.pha.pa.us>
To: Gaetano Mendola <mendola@bigfoot.com>
Cc: pgsql-admin@postgresql.org
Subject: Re: fsync or fdatasync
Date: Tue, 10 Sep 2002 11:40:24 -0400 (EDT)
Message-ID: <200209101540.g8AFeOo21086@candle.pha.pa.us> (raw)
In-Reply-To: <alil6f$fie$1@news.hub.org>


The original poster was wrong about the default.

We use fdatasync where available, and fsync when it is not.  We also use
O_SYNC on open if it is available.

---------------------------------------------------------------------------

Gaetano Mendola wrote:
> 
> "Tom Lane" <tgl@sss.pgh.pa.us> wrote in message
> news:11753.1031590251@sss.pgh.pa.us...
> > "Gaetano Mendola" <mendola@bigfoot.com> writes:
> > > apparently the default value for wal_sync_method is fsync,
> > > and apparently the best method is fdatasync.
> >
> > Best on what platform, and according to what evidence?
> 
> Well, the man say ( Linux ):
> 
> 
> fdatasync flushes all data buffers of a file to disk (before the system call
> returns).  It resembles fsync but is
>        not required to update the metadata such as access time.
> 
>        Applications that access databases or log files often write a tiny
> data fragment (e.g., one line in a  log  file)
>        and  then  call  fsync immediately in order to ensure that the
> written data is physically stored on the harddisk.
>        Unfortunately, fsync will always initiate two write operations: one
> for the newly written data and another one in
>        order to update the modification time stored in the inode. If the
> modification time is not a part of the transacĀ­
>        tion concept fdatasync can be used to avoid unnecessary inode disk
> write operations.
> 
> 
> So, what is wrong here ? Seems clear that one write is better than two.
> 
> Ciao
> Gaetano
> 
> 
> 
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
> 
> http://www.postgresql.org/users-lounge/docs/faq.html
> 

-- 
  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: <200209101540.g8AFeOo21086@candle.pha.pa.us>
Permalink:  ../200209101540.g8AFeOo21086@candle.pha.pa.us/
Also on:    postgresql.org/message-id/200209101540.g8AFeOo21086@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, mendola@bigfoot.com
  Subject: Re: fsync or fdatasync
  In-Reply-To: <200209101540.g8AFeOo21086@candle.pha.pa.us>
  References: <alil6f$fie$1@news.hub.org> <200209101540.g8AFeOo21086@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