Skip site navigation (1) Skip section navigation (2)

Re: how unsafe (or worst scenarios) when setting fsync

From: Simon Riggs <simon(at)2ndquadrant(dot)com>
To: guoping(dot)zhang(at)nec(dot)com(dot)au
Cc: pgsql-performance(at)postgresql(dot)org, "Guoping Zhang (E-mail)" <guopingz(at)nstc(dot)nec(dot)com(dot)au>
Subject: Re: how unsafe (or worst scenarios) when setting fsync
Date: 2006-04-27 07:13:04
Message-ID: 1146121984.3120.56.camel@localhost.localdomain (view raw or flat)
Thread:
Lists: pgsql-performance
On Thu, 2006-04-27 at 16:31 +1000, Guoping Zhang wrote:

> We have to looking at setting fsync OFF option for performance reason,
> our questions are
> 
>   a) if we set fsync OFF and anything (very low chance though) like OS
> crash, loss of power, or hardware fault happened, can postgresql rolls back
> to the state that the last checkpoint was done ( but all the operations
> after that is lost)

There is no rollback, only a rollforward from the checkpoint.

>   b) Does this roll back to last checkpoint can ensure the database back to
> consistent state?

Therefore no consistent state guaranteed if some WAL is missing

>   c) What is worst scenarios if setting fsync OFF in term of database
> safety. We try to avoid to restore the database from nightly backup.

Losing some DDL changes, probably. You'd need to be wary of things like
ANALYZE, VACUUM etc, since these make catalog changes also.

> We view our application is not that data loss critical, say loss of five
> minutes of data and operation occasionally, but the database integrity and
> consistency must be kept.
> 
> Can we set fsync OFF for the performance benefit, have the risk of only 5
> minutes data loss or much worse?

Thats up to you. 

fsync can be turned on and off, so you can make critical changes with
fsync on, then continue with fsync off.

The risk and the decision, are yours. You are warned.

-- 
  Simon Riggs
  EnterpriseDB          http://www.enterprisedb.com/


In response to

Responses

pgsql-performance by date

Next:From: Mikael CarneholmDate: 2006-04-27 07:42:54
Subject: Re: how unsafe (or worst scenarios) when setting fsync OFF for postgresql
Previous:From: Guoping ZhangDate: 2006-04-27 06:31:23
Subject: how unsafe (or worst scenarios) when setting fsync OFF for postgresql

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group