Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id D90C7B5DCE3 for ; Wed, 13 Jul 2011 18:57:56 -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 28888-07 for ; Wed, 13 Jul 2011 21:57:50 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from gw.wicourts.gov (gwmta.wicourts.gov [165.219.244.99]) by mail.postgresql.org (Postfix) with ESMTP id 8D88AB5DCDF for ; Wed, 13 Jul 2011 18:57:50 -0300 (ADT) Received: from Courts-MTA by gw.wicourts.gov with Novell_GroupWise; Wed, 13 Jul 2011 16:57:44 -0500 Message-Id: <4E1DCE81020000250003F2DC@gw.wicourts.gov> X-Mailer: Novell GroupWise Internet Agent 8.0.1 Date: Wed, 13 Jul 2011 16:57:37 -0500 From: "Kevin Grittner" To: "Tom Lane" Cc: "Ivan Voras" , , "lars" Subject: Re: UPDATEDs slowing SELECTs in a fully cached database References: <4E16479D.3050605@yahoo.com> <4E1A0CBC.6090009@yahoo.com> <4E1A31AB.9010201@postnewspapers.com.au> <1310359653.80687.YahooMailRC@web121705.mail.ne1.yahoo.com> <4E1AEDAB020000250003F1C3@gw.wicourts.gov> <4E1B41EA.90104@yahoo.com> <4E1B05CC020000250003F1E6@gw.wicourts.gov> <4E1B810D.4070404@yahoo.com> <4E1B90AF.1020408@yahoo.com> <4E1C9A05.7060005@yahoo.com> <4E1C5563020000250003F252@gw.wicourts.gov> <4E1CA8E9.6090108@yahoo.com> <4E1CB56E.7080801@yahoo.com> <4E1D697C020000250003F29A@gw.wicourts.gov><4E1D697C020000250003F29A@gw.wicourts.gov> <4752.1310570261@sss.pgh.pa.us> In-Reply-To: <4752.1310570261@sss.pgh.pa.us> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-10 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201107/141 X-Sequence-Number: 44353 Tom Lane wrote: > Huh? If there was never an XID, there's no commit WAL record, > hence nothing to make asynchronous. If you look at the RecordTransactionCommit() function in xact.c you'll see that's not correct. Currently the commit record has nothing to do with whether it synchronizes on WAL writes. In particular, this section around line 1096 is where the choice is made: if ((wrote_xlog && synchronous_commit > SYNCHRONOUS_COMMIT_OFF) || forceSyncCommit || nrels > 0) { /* * Synchronous commit case: In the OP's test case, wrote_xlog is true, while forceSyncCommit is false and nrels == 0. It doesn't seem like commit of a read-only transaction should be a magical time for pruning WAL entries to hit the disk, so it probably would work to modify that "if" to not drop into the synchronous commit code if the transaction is explicitly declared READ ONLY or if it never acquired an XID; although there's likely some better way to deal with it. -Kevin