Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id CC39DB5DCEF for ; Tue, 12 Jul 2011 20:15:49 -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 70665-09 for ; Tue, 12 Jul 2011 23:15:43 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from nm16-vm3.bullet.mail.ne1.yahoo.com (nm16-vm3.bullet.mail.ne1.yahoo.com [98.138.91.146]) by mail.postgresql.org (Postfix) with SMTP id 1B09DB5DCE3 for ; Tue, 12 Jul 2011 20:15:42 -0300 (ADT) Received: from [98.138.90.52] by nm16.bullet.mail.ne1.yahoo.com with NNFMP; 12 Jul 2011 23:15:42 -0000 Received: from [98.138.84.44] by tm5.bullet.mail.ne1.yahoo.com with NNFMP; 12 Jul 2011 23:15:42 -0000 Received: from [127.0.0.1] by smtp112.mail.ne1.yahoo.com with NNFMP; 12 Jul 2011 23:15:42 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1310512542; bh=3i2CSdGfRDv7NmN2zm1qrLKZqthLxUINkU9AW6y3mso=; 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=PoBKTRRxUJOD53Z3+zDlQy6O9yAM4gE91Ahd356T9St3s8o9RiyhhpJUz7aoXHKK0sVndJFozCWajAtDK6jhVhnUyddfjv6ixJwazjmyGvxo1ze2PdjJLER2OpI7VDCyGZf58cqvGyzylTvgmHwU45Aufb9ArIr0VYdq4AJHxIE= X-Yahoo-Newman-Id: 203106.40895.bm@smtp112.mail.ne1.yahoo.com Received: from [192.168.206.5] (lhofhansl@67.170.234.149 with plain) by smtp112.mail.ne1.yahoo.com with SMTP; 12 Jul 2011 16:15:41 -0700 PDT X-Yahoo-SMTP: YmezqLWswBDx0ai534H100MJuqGzDQ-- X-YMail-OSG: ppY74AIVM1mythaYMQDYctU5OPEo_RaOJaBNI11AkUGJ2vF o8tdXVKa2AlMxzV0yy2K2hLYK49MWquN.urn1n254u0L0YS02S_XrHKginnk kOJ311sWdSeDi7A9zZlqVhaAUfjNfTDm8aTnpI3mSntMQZJ4KryaUcIE96O0 _UVJ_CbYR9v0dwQpbf1ylaUErYawGO5efkidsWLe.hThwvK47aoqN2azVp6R bSMSC_2IiVkfl2U22wjEL_bPKVpow8Hm3a5ZP5exj_n0J2kakB45rU7pxA9M gE9nByiUHPPFTLq0E_M7lbHHOk45e2_SyNblj.MOInDfDCTQdqnlZKqr4Ffy I0RiHcgKzuYS_2vYmczPTUg-- X-Yahoo-Newman-Property: ymail-3 Message-ID: <4E1CD580.3030100@yahoo.com> Date: Tue, 12 Jul 2011 16:15:12 -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: Merlin Moncure CC: Kevin Grittner , 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> In-Reply-To: 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/127 X-Sequence-Number: 44339 On 07/12/2011 02:38 PM, Merlin Moncure wrote: > > Something is not adding up here. Perhaps there is an alternate route > to WAL logged activity from selects I'm not thinking of. Right now > I'm thinking to run the selects on table 'a' and the inserts > concurrently on table 'b' and seeing how that behaves. Another way to > get to the bottom is to oprofile the selecting-during-load backend to > see where the time is getting spent. Alternative way to do this is > to strace attach to the selecting-during-load backend to see if it's > really writing to the WAL (I'm really curious about this). > > Another interesting test would be to try and reproduce the results on > native machine. It should be possible to do this on your workstation > with a more modestly sized scaling factor. > > merlin > Just tried with two of my test tables. Updates on 'a' have no (measurable) effect on select from 'b'. Back to the first case, here's an strace from the backend doing the select right after the updates. "Q\0\0\0`select count(*) from test1 "..., 8192, 0, NULL, NULL) = 97 gettimeofday({1310512219, 723762}, NULL) = 0 open("base/16385/33032", O_RDWR) = 8 lseek(8, 0, SEEK_END) = 1073741824 open("base/16385/33032.1", O_RDWR|O_CREAT, 0600) = 9 lseek(9, 0, SEEK_END) = 1073741824 open("base/16385/33032.2", O_RDWR|O_CREAT, 0600) = 10 lseek(10, 0, SEEK_END) = 191348736 open("base/16385/33035", O_RDWR) = 11 lseek(11, 0, SEEK_END) = 1073741824 open("base/16385/33035.1", O_RDWR|O_CREAT, 0600) = 12 lseek(12, 0, SEEK_END) = 3571712 lseek(10, 0, SEEK_END) = 191348736 brk(0x28ad000) = 0x28ad000 mmap(NULL, 135168, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f5f28ca0000 mmap(NULL, 266240, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f5f28c5f000 munmap(0x7f5f28c5f000, 266240) = 0 munmap(0x7f5f28ca0000, 135168) = 0 open("pg_xlog/00000001000000BB00000012", O_RDWR) = 13 lseek(13, 1564672, SEEK_SET) = 1564672 write(13, "f\320\1\0\1\0\0\0\273\0\0\0\0\340\27\22`\32\0\00000002833!000"..., 2400256) = 2400256 fdatasync(13) = 0 semop(229383, {{9, 1, 0}}, 1) = 0 gettimeofday({1310512219, 885287}, NULL) = 0 sendto(5, "\2\0\0\0\300\3\0\0\1@\0\0\t\0\0\0\1\0\0\0\0\0\0\0\353\4\0\0@\0\2\0"..., 960, 0, NULL, 0) = 960 sendto(5, "\2\0\0\0\300\3\0\0\1@\0\0\t\0\0\0\0\0\0\0\0\0\0\0009\n\0\0@\0\2\0"..., 960, 0, NULL, 0) = 960 sendto(5, "\2\0\0\0\300\3\0\0\1@\0\0\t\0\0\0\0\0\0\0\0\0\0\0v\n\0\0@\0\2\0"..., 960, 0, NULL, 0) = 960 sendto(5, "\2\0\0\0\270\1\0\0\0\0\0\0\4\0\0\0\0\0\0\0\0\0\0\0\275\4\0\0\377\177\0\0"..., 440, 0, NULL, 0) = 440 sendto(6, "T\0\0\0\36\0\1count\0\0\0\0\0\0\0\0\0\0\24\0\10\377\377\377\377\0\0D"..., 66, 0, NULL, 0) = 66 So the backend definitely writing to the WAL, directly and synchronously. Selecting the same set of rows again: "Q\0\0\0`select count(*) from test1 "..., 8192, 0, NULL, NULL) = 97 gettimeofday({1310512344, 823728}, NULL) = 0 lseek(10, 0, SEEK_END) = 191348736 lseek(12, 0, SEEK_END) = 3571712 lseek(10, 0, SEEK_END) = 191348736 brk(0x28d5000) = 0x28d5000 brk(0x2915000) = 0x2915000 brk(0x2897000) = 0x2897000 gettimeofday({1310512344, 831043}, NULL) = 0 sendto(5, "\2\0\0\0\350\0\0\0\1@\0\0\2\0\0\0\1\0\0\0\0\0\0\0\10\201\0\0?\0\2\0"..., 232, 0, NULL, 0) = 232 sendto(6, "T\0\0\0\36\0\1count\0\0\0\0\0\0\0\0\0\0\24\0\10\377\377\377\377\0\0D"..., 66, 0, NULL, 0) = 66 No writing to the WAL. -- Lars