Kevin Brown <kevin@sysexperts.com> writes:
> I suspect the answer to that is that you can safely turn off fsync
> only if the operating system will guarantee that write transactions
> from a process are actually committed in the order they arrive from
> that process.
Yeah. We use fsync partly so that when we tell a client a transaction
is committed, it really is committed (ie, down to disk) --- but also
as a means of controlling write order. I strongly doubt that any modern
filesystem will promise to execute writes exactly in the order issued,
unless prodded by means such as fsync.
> Otherwise you'd have to worry about write transactions
> to the transaction log committing before the writes to the data files
> during a savepoint,
Actually, the other way around is the problem. The WAL algorithm works
so long as log writes hit disk before the data-file changes they
describe (that's why it's called write *ahead* log).
regards, tom lane