> John Holland <jholland@isr.umd.edu> writes:
> > can you explain the -F flag? when is it passed to what?
>
> -F is a command-line flag passed to the backend at backend startup.
> Since backends are normally started by the postmaster, what you
> really do in practice is to start the postmaster with "-o -F".
> For example my postmaster start script looks like
>
> nohup postmaster -i -o "-F" >server.log 2>&1 </dev/null &
>
> What the -F switch actually does is to disable calls to fsync(2),
> thereby allowing modified file blocks to hang around in kernel
> memory for a little while (up to 30 seconds in most Unixes)
> rather than being force-written to disk as soon as each transaction
> commits. If the same block of the database file gets modified
> again within that time window (very likely under a repeated-update
> load), you just saved a disk write. On the other hand, if your OS
> crashes or your power goes out in those 30 sec, you just lost a
> database update that you thought you had committed.
>
> I'm not sure I believe the argument that omitting -F buys very much
> safety, even if you do not trust your power company. Murphy's law
> says that a power flicker will happen in the middle of committing
> a transaction, not during the 30-second-max window between when you
> could've had the data flushed to disk if only you'd used fsync()
> and when the swapper process will fsync it on its own. And in that
> case you have a corrupted database anyway. So my theory is you use
> a reliable OS, and get yourself a UPS if your power company isn't
> reliable (lord knows mine ain't), and back up your database as often
> as you can. -F buys enough speed that it's worth the small extra risk.
>
> There are competent experts with conflicting opinions, however ;-)
>
> See doc/README.fsync for more about -F and the implications of
> using it.
Well said, and I think we have to address this shortcoming. Vadim has
been reluctant to turn off fsync by default. I have been trying to come
up with some soft-fsync on my own but haven't hit on anything he agrees
with yet.
-- Bruce Momjian | http://www.op.net/~candle maillist@candle.pha.pa.us | (610)
853-3000+ If your life is a hard drive, | 830 Blythe Avenue + Christ can be your backup. | Drexel Hill,
Pennsylvania19026