X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 702E311F61E8 for ; Thu, 27 Apr 2006 04:13:35 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 65798-02 for ; Thu, 27 Apr 2006 04:13:21 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.187]) by postgresql.org (Postfix) with ESMTP id 93D5211F66FA for ; Thu, 27 Apr 2006 04:13:20 -0300 (ADT) Received: from [195.112.43.22] (helo=[192.168.0.7]) by mrelayeu.kundenserver.de (node=mrelayeu8) with ESMTP (Nemesis), id 0ML2ov-1FZ0gb0MvG-0001Qp; Thu, 27 Apr 2006 09:13:14 +0200 Subject: Re: how unsafe (or worst scenarios) when setting fsync From: Simon Riggs To: guoping.zhang@nec.com.au Cc: pgsql-performance@postgresql.org, "Guoping Zhang (E-mail)" In-Reply-To: <003b01c669c4$34bbd7b0$74304c93@eddy> References: <003b01c669c4$34bbd7b0$74304c93@eddy> Content-Type: text/plain Date: Thu, 27 Apr 2006 08:13:04 +0100 Message-Id: <1146121984.3120.56.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.2.3 (2.2.3-4.fc4) Content-Transfer-Encoding: 7bit X-Provags-ID: kundenserver.de abuse@kundenserver.de login:726643fe08f41a451f0fe7fa43bce239 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200604/628 X-Sequence-Number: 18712 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/