>
> Bruce Momjian wrote:
> >
> > >
> > > Hi,
> > >
> > > perhaps a stupid question:
> > >
> > > What will happen, if you start PostgreSQL with -F and write a script
> > > which is a loop that fsyncs every 2 seconds? Does this lead to a
> > > database which is "almost" correct? Does this seem like a good
> > > compromise?
> >
> > Well, you really have to sync the data pages BEFORE sync'ing pg_log.
>
> Why should this be necessary? If the transaction is considered
> committed once the log has be written, and the system crashes before
> the data are written, then postgres can look at the data and logs when
> it is next started up and apply all the transactions that were logged
> but not committed to the data pages.
No, on restart, you can't identify the old/new data. Remember, pg_log
is just the transaction id and a flag. The superceeded/new rows are
mixed on the data pages, with transaction id's as markers.
>
> Am I missing something? It seems to me if you sync the data pages
> first, then what good is the log? (other than being able to retrace
> your steps)
Again, the log is just a list of transaction ids, and their statuses.
--
Bruce Momjian
maillist@candle.pha.pa.us