Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id A633E475DF2 for ; Mon, 9 Sep 2002 13:19:23 -0400 (EDT) Received: from news.hub.org (news.hub.org [64.49.215.80]) by postgresql.org (Postfix) with ESMTP id BD02C47623E for ; Mon, 9 Sep 2002 13:19:12 -0400 (EDT) Received: by news.hub.org (Postfix, from userid 8) id 81CFC38198B; Mon, 9 Sep 2002 13:19:12 -0400 (EDT) From: "Gaetano Mendola" X-Newsgroups: comp.databases.postgresql.admin Subject: Re: fsync or fdatasync Date: Mon, 9 Sep 2002 19:19:09 +0200 Organization: Hub.Org Networking Services (http://www.hub.org) Lines: 35 Message-ID: References: <11753.1031590251@sss.pgh.pa.us> X-Complaints-To: news@hub.org X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 To: pgsql-admin@postgresql.org X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200209/105 X-Sequence-Number: 5644 "Tom Lane" wrote in message news:11753.1031590251@sss.pgh.pa.us... > "Gaetano Mendola" writes: > > apparently the default value for wal_sync_method is fsync, > > and apparently the best method is fdatasync. > > Best on what platform, and according to what evidence? Well, the man say ( Linux ): fdatasync flushes all data buffers of a file to disk (before the system call returns). It resembles fsync but is not required to update the metadata such as access time. Applications that access databases or log files often write a tiny data fragment (e.g., one line in a log file) and then call fsync immediately in order to ensure that the written data is physically stored on the harddisk. Unfortunately, fsync will always initiate two write operations: one for the newly written data and another one in order to update the modification time stored in the inode. If the modification time is not a part of the transac­ tion concept fdatasync can be used to avoid unnecessary inode disk write operations. So, what is wrong here ? Seems clear that one write is better than two. Ciao Gaetano