Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Ysvxh-0005rb-8B for pgsql-admin@arkaria.postgresql.org; Thu, 14 May 2015 16:26:17 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Ysvxg-0001ny-OA for pgsql-admin@arkaria.postgresql.org; Thu, 14 May 2015 16:26:16 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1Ysvxe-0001lL-Uo for pgsql-admin@postgresql.org; Thu, 14 May 2015 16:26:15 +0000 Received: from momjian.us ([72.94.173.45]) by makus.postgresql.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.84) (envelope-from ) id 1Ysvxc-0002Do-3I for pgsql-admin@postgresql.org; Thu, 14 May 2015 16:26:13 +0000 Received: from bruce by momjian.us with local (Exim 4.72) (envelope-from ) id 1Ysvxa-0006bW-DN; Thu, 14 May 2015 12:26:10 -0400 Date: Thu, 14 May 2015 12:26:10 -0400 From: Bruce Momjian To: Ravi Krishna Cc: tgl@sss.pgh.pa.us, pgsql-admin@postgresql.org Subject: Re: WAL and O_DIRECT Message-ID: <20150514162610.GB23739@momjian.us> References: <21483.1431618933@sss.pgh.pa.us> <14d532dde85-2108-310a1@webstg-m03.mail.aol.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <14d532dde85-2108-310a1@webstg-m03.mail.aol.com> User-Agent: Mutt/1.5.20 (2009-06-14) X-Pg-Spam-Score: -1.9 (-) 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, May 14, 2015 at 12:07:04PM -0400, Ravi Krishna wrote: > >> However our DB2 folks are raising a concern that PG WAL writes may not be crash safe, unless we are using > >> write back technology in SAN or SSD , which we are using. > > > What's your point exactly? If the underlying hardware does not provide durable writes, there's > > nothing PG (or DB2) can do to fix that. > > > Am I right in concluding that PG WAL writes without underlying h/w caching is not crash proof. > Fortunately these days caching is ubiquitous in all SSD/SAN technology. Both Oracle and DB2 always open WAL > logs in O_DIRECT. Is this thinking outdated with modern technology which caches writes. Wonder why Oracle/DB2 > are not making O_DIRECT optional. I am sure it will increase the write performance. Basically, O_DIRECT writes through the OS catch directly to the storage. Postgres writes to the OS cache, then uses fsync() or another OS call to flush that OS write to the storage --- we just do it in two parts. We turn off O_DIRECT for WAL writes because we know another process is going to read it soon, so in that case, we fall back the two-part solution of OS write and fsync-like OS call. -- 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