Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 2625E632592 for ; Wed, 30 Jun 2010 11:31:22 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 57800-04 for ; Wed, 30 Jun 2010 14:31:10 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from outbound.afilias.info (outbound.afilias.info [69.46.124.26]) by mail.postgresql.org (Postfix) with ESMTP id ED6F6632422 for ; Wed, 30 Jun 2010 11:31:11 -0300 (ADT) Received: from ms5.yyz2.afilias-ops.info ([10.50.129.111] helo=smtp.afilias.info) by outbound.afilias.info with esmtp (Exim 4.69) (envelope-from ) id 1OTyJV-0000fc-6I; Wed, 30 Jun 2010 14:30:57 +0000 Received: from tor-gateway.afilias.info ([199.15.87.4] helo=[10.10.46.12]) by smtp.afilias.info with esmtps (SSLv3:AES256-SHA:256) (Exim 4.69) (envelope-from ) id 1OTyJV-0006Tv-5b; Wed, 30 Jun 2010 14:30:57 +0000 Subject: Re: PostgreSQL as a local in-memory cache From: Brad Nicholson To: Bruce Momjian Cc: Jignesh Shah , Tom Lane , Robert Haas , Dimitri Fontaine , Josh Berkus , postgres performance list In-Reply-To: <201006300139.o5U1dHN12285@momjian.us> References: <201006300139.o5U1dHN12285@momjian.us> Content-Type: text/plain; charset="UTF-8" Date: Wed, 30 Jun 2010 10:30:57 -0400 Message-ID: <1277908257.19899.67.camel@bnicholson-desktop> Mime-Version: 1.0 X-Mailer: Evolution 2.28.3 Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-4.21 tagged_above=-10 required=5 tests=BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201006/526 X-Sequence-Number: 39382 On Tue, 2010-06-29 at 21:39 -0400, Bruce Momjian wrote: > Jignesh Shah wrote: > > On Tue, Jun 29, 2010 at 2:45 PM, Bruce Momjian wrote: > > > Tom Lane wrote: > > >> Bruce Momjian writes: > > >> >>> I asked on IRC and was told it is true, and looking at the C code it > > >> >>> looks true. ?What synchronous_commit = false does is to delay writing > > >> >>> the wal buffers to disk and fsyncing them, not just fsync, which is > > >> >>> where the commit loss due to db process crash comes from. > > >> > > >> >> Ah, I see. ?Thanks. > > >> > > >> > I am personally surprised it was designed that way; ?I thought we would > > >> > just delay fsync. > > >> > > >> That would require writing and syncing to be separable actions. ?If > > >> you're using O_SYNC or similar, they aren't. > > > > > > Ah, very good point. ?I have added a C comment to clarify why this is > > > the current behavior; ?attached and applied. > > > > > > -- > > > ?Bruce Momjian ? ? ? ? ?http://momjian.us > > > ?EnterpriseDB ? ? ? ? ? ? ? ? ? ? ? ? ? ? http://enterprisedb.com > > > > > > Though has anybody seen a behaviour where synchronous_commit=off is > > slower than synchronous_commit=on ? Again there are two cases here > > one with O_* flag and other with f*sync flags. But I had seen that > > behavior with PostgreSQL 9.0 beta(2 I think) though havent really > > investigated it much yet .. (though now I dont remember which > > wal_sync_method flag) . Just curious if anybody has seen that > > behavior.. > > I have trouble believing how synchronous_commit=off could be slower than > 'on'. > I wonder if it could be contention on wal buffers? Say I've turned synchronous_commit off, I drive enough traffic fill up my wal_buffers. I assume that we would have to start writing buffers down to disk before allocating to the new process. -- Brad Nicholson 416-673-4106 Database Administrator, Afilias Canada Corp.