Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WbKxX-0008PG-MK for pgsql-admin@arkaria.postgresql.org; Sat, 19 Apr 2014 02:24:51 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1WbKxX-0006vI-3q for pgsql-admin@arkaria.postgresql.org; Sat, 19 Apr 2014 02:24:51 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WbKxW-0006vC-BJ for pgsql-admin@postgresql.org; Sat, 19 Apr 2014 02:24:50 +0000 Received: from momjian.us ([72.94.173.45]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WbKxU-0006Qb-1B for pgsql-admin@postgresql.org; Sat, 19 Apr 2014 02:24:49 +0000 Received: from bruce by momjian.us with local (Exim 4.72) (envelope-from ) id 1WbKxT-0003O5-EB; Fri, 18 Apr 2014 22:24:47 -0400 Date: Fri, 18 Apr 2014 22:24:47 -0400 From: Bruce Momjian To: David G Johnston Cc: pgsql-admin@postgresql.org Subject: Re: Difference between fsync and open_sync Message-ID: <20140419022447.GB16260@momjian.us> References: <1397793265476-5800669.post@n5.nabble.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1397793265476-5800669.post@n5.nabble.com> User-Agent: Mutt/1.5.20 (2009-06-14) X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-admin Precedence: bulk Sender: pgsql-admin-owner@postgresql.org On Thu, Apr 17, 2014 at 08:54:25PM -0700, David G Johnston wrote: > > And i understood the difference between, for example, fsync and fdatasync, > > and between open_datasync and open_sync, but i cannot understand the > > difference between open_sync and fsync or between open_datasync and > > fdatasync , As far as i could understand, the open_* methods call the > > open() method of linux, and f*sync methods calls the fsync() method of > > linux? > > > > My doubt is about what's the difference between them, or a link where this > > is explained. In the previous link it talks about the 4 methods but i > > cannot distinguish the difference between them. > > fsync and open are both system functions for which documentation exists on > the Internet. > > Short answer seems to be that the physical write is guaranteed: open = > immediately; fsync = at commit > > As long as "fsync mode" is on after a commit command returns the WAL is > promised to be physically written to disk; the means and speed of doing so > vary according to the method chosen (limited by platform), the workload, the > hardware, and the OS. > > Others will correct any misunderstandings I may have acquired in my quick > reading and reasoning. The open* sync methods use a flag when the file is open that cause _every_ write to be flushed to disk automatically. The non-open* types allow multiple writes and require a specific sync* command to be issued when needed. -- Bruce Momjian http://momjian.us EnterpriseDB http://enterprisedb.com + Everyone has their own god. + -- Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-admin