> Mac OS X: Like Solaris, there's a similar mechanism but it's not
> O_DIRECT; see
> http://stackoverflow.com/questions/2299402/how-does-one-do-raw-io-on-mac-os-x-ie-equivalent-to-linuxs-o-direct-flag
> for notes about the F_NOCACHE feature used. Same basic situation as
> Solaris; there's an API, but PostgreSQL doesn't use it yet.
Actually, on OSX 10.5.8, o_dsync and fdatasync aren't even available.
From my run, it looks like even so regular fsync might be better than
open_sync. Results from a MacBook:
Sidney-Stratton:fsync josh$ ./test_fsync
Loops = 10000
Simple write:8k write 2121.004/second
Compare file sync methods using one write:(open_datasync unavailable)open_sync 8k write
1993.833/second(fdatasyncunavailable)8k write, fsync 1878.154/second
Compare file sync methods using two writes:(open_datasync unavailable)2 open_sync 8k writes
1005.009/second(fdatasyncunavailable)8k write, 8k write, fsync 1709.862/second
Compare open_sync with different sizes:open_sync 16k write 1728.803/second2 open_sync 8k writes
969.416/second
Test if fsync on non-write file descriptor is honored:
(If the times are similar, fsync() can sync data written
on a different descriptor.)8k write, fsync, close 1772.572/second8k write, close, fsync
1939.897/second
-- -- Josh Berkus PostgreSQL Experts Inc.
http://www.pgexperts.com