Re: Ensuring data integrity with fsync=off

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Benjamin Arai" <barai(at)cs(dot)ucr(dot)edu>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Ensuring data integrity with fsync=off
Date: 2006-01-14 18:41:43
Message-ID: 20897.1137264103@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

"Benjamin Arai" <barai(at)cs(dot)ucr(dot)edu> writes:
> Right now I run "sync" afte the updates have finished to ensure that the
> data is synced to disk but I am concerned about the segment data and
> anything else I am missing that PostgreSQL explicitly handles. Is there
> something I can do in addition to sync to tell PostgreSQL exlplicitly that
> it is time to ensure everything is stored in its final destionation and etc?

You need to give PG a CHECKPOINT command to flush stuff out of its
internal buffers. After that finishes, a manual "sync" commnd will
push everything down to disk.

You realize, of course, that a system failure while the updates are
running might leave your database corrupt? As long as you are prepared
to restore from scratch, this might be a good tradeoff ... but don't
let yourself get caught without an up-to-date backup ...

regards, tom lane

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Jaime Casanova 2006-01-14 20:31:43 Re: big databases & hospitals
Previous Message Benjamin Arai 2006-01-14 18:13:27 Ensuring data integrity with fsync=off