Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id F2B9EB5DC33 for ; Wed, 13 Jul 2011 19:41:52 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 47131-04 for ; Wed, 13 Jul 2011 22:41:47 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from nm22.bullet.mail.sp2.yahoo.com (nm22.bullet.mail.sp2.yahoo.com [98.139.91.92]) by mail.postgresql.org (Postfix) with SMTP id 7C6C2B5DBF4 for ; Wed, 13 Jul 2011 19:41:46 -0300 (ADT) Received: from [98.139.91.70] by nm22.bullet.mail.sp2.yahoo.com with NNFMP; 13 Jul 2011 22:41:45 -0000 Received: from [208.71.42.193] by tm10.bullet.mail.sp2.yahoo.com with NNFMP; 13 Jul 2011 22:41:45 -0000 Received: from [127.0.0.1] by smtp204.mail.gq1.yahoo.com with NNFMP; 13 Jul 2011 22:41:45 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1310596905; bh=yu1h1vZrvmF9vNXIjIyZqIp2N4fVc2/LF+Hgd+5WlGw=; h=X-Yahoo-Newman-Id:Received:X-Yahoo-SMTP:X-YMail-OSG:X-Yahoo-Newman-Property:Message-ID:Date:From:User-Agent:MIME-Version:To:CC:Subject:References:In-Reply-To:Content-Type:Content-Transfer-Encoding; b=HLqkOeXOFK+I0GP9mY7eGe7mp523za7FOI+x3YzkKZYw1DSbJdKf4TSUl+nb/oSk7TKZQ8bCSDP3HmWTqIRMjZZcP9xdn4Y6Zr/2PcVr+RlfH4AA2bIxF6a5eHGGrYZvM8MbQh/hDWr9uMcnZHixwIrnLAiSNKO9+ugPloaFC1g= X-Yahoo-Newman-Id: 726720.41488.bm@smtp204.mail.gq1.yahoo.com Received: from [192.168.206.5] (lhofhansl@67.170.234.149 with plain) by smtp204.mail.gq1.yahoo.com with SMTP; 13 Jul 2011 15:41:45 -0700 PDT X-Yahoo-SMTP: YmezqLWswBDx0ai534H100MJuqGzDQ-- X-YMail-OSG: wcojbp0VM1kr.eGVzbFi246aT_no.7BSgez46B.avDc5DA3 aKFW7Y75yPHRG6Ffu9jzLae8clM4dG3jFDTN851Yy5s2DmsOxe00J1FaUsPI QNiicrPG_KKGObRLGf3clq4jnjMJS_FgOWL8F6tWhnkt9RdxCFPSUUb5gIJk aekD17.Q1kBTK3Xw6HeyYiIREiVM2YtqQRoHCc76F7o4xGCcYTN2b31mFvWI .pXWwnpRd9f1HzAPCmmROXgp.3XcNXNg3QUnBC9QPo.cDJGht44WZXzHsadt 5E1Os2JfGdXP1_fS3a1MeghPvF8eb04lkDUQ6h36pyk6SlcQxlePCpaUkPEE 1Y6eu6LMAas7LFa99xOvCP.jj3dwsd5V5kd7M3RTy X-Yahoo-Newman-Property: ymail-3 Message-ID: <4E1E1F0C.70005@yahoo.com> Date: Wed, 13 Jul 2011 15:41:16 -0700 From: lars User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.18) Gecko/20110621 Fedora/3.1.11-1.fc14 Thunderbird/3.1.11 MIME-Version: 1.0 To: Kevin Grittner CC: Ivan Voras , pgsql-performance@postgresql.org 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> <4E1DE28D.6020207@yahoo.com> <4E1DA0C2020000250003F2B1@gw.wicourts.gov> In-Reply-To: <4E1DA0C2020000250003F2B1@gw.wicourts.gov> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.909 tagged_above=-10 required=5 tests=BAYES_00=-1.9, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201107/143 X-Sequence-Number: 44355 On 07/13/2011 11:42 AM, Kevin Grittner wrote: > So transactions without an XID *are* sensitive to > synchronous_commit. That's likely a useful clue. > > How much did it help the run time of the SELECT which followed the > UPDATE? It has surprisingly little impact on the SELECT side: => set synchronous_commit = on; => update test set created_by = '000000000000001' where tenant = '000000000000001'; UPDATE 3712 Time: 384.702 ms lars=> select count(*) from test where tenant = '000000000000001' and created_date = '2011-6-30'; count ------- 3712 (1 row) Time: 36.571 ms => select count(*) from test where tenant = '000000000000001' and created_date = '2011-6-30'; count ------- 3712 (1 row) Time: 5.702 ms => select count(*) from test where tenant = '000000000000001' and created_date = '2011-6-30'; count ------- 3712 (1 row) Time: 5.822 ms => set synchronous_commit = off; SET Time: 0.145 ms => update test set created_by = '000000000000001' where tenant = '000000000000001'; UPDATE 3712 Time: 96.227 ms => select count(*) from test where tenant = '000000000000001' and created_date = '2011-6-30'; count ------- 3712 (1 row) Time: 32.422 ms => select count(*) from test where tenant = '000000000000001' and created_date = '2011-6-30'; count ------- 3712 (1 row) Time: 6.080 ms I tried it multiple times, and while the numbers change by 5-10ms the relationship is the same. The same results show when I use my JDBC code to run updates/selects as fast as possible. When synchronous_commit is off for the SELECTing process it seems to be slightly faster. -- Lars