Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1ZQHwV-0004FL-Tz for pgsql-performance@arkaria.postgresql.org; Fri, 14 Aug 2015 16:34:56 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1ZQHwV-0003gP-Fz for pgsql-performance@arkaria.postgresql.org; Fri, 14 Aug 2015 16:34:55 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1ZQHwU-0003ds-76 for pgsql-performance@postgresql.org; Fri, 14 Aug 2015 16:34:54 +0000 Received: from 01.zmailcloud.com ([192.198.85.104] helo=mx-out-1.zmailcloud.com) by magus.postgresql.org with esmtp (Exim 4.84) (envelope-from ) id 1ZQHwP-0003JE-Qe for pgsql-performance@postgresql.org; Fri, 14 Aug 2015 16:34:53 +0000 Received: from smtp.01.com (smtp.01.com [10.10.0.43]) by mx-out-1.zmailcloud.com (Postfix) with ESMTP id 1E3F9570091; Fri, 14 Aug 2015 11:34:35 -0500 (CDT) Received: from localhost (localhost [127.0.0.1]) by smtp-out-2.01.com (Postfix) with ESMTP id 10F3860202; Fri, 14 Aug 2015 11:34:35 -0500 (CDT) X-Virus-Scanned: amavisd-new at smtp-out-2.01.com Received: from smtp.01.com ([127.0.0.1]) by localhost (smtp-out-2.01.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 2C4uhbR3NMm6; Fri, 14 Aug 2015 11:34:34 -0500 (CDT) Received: from smtp.01.com (localhost [127.0.0.1]) by smtp-out-2.01.com (Postfix) with ESMTP id DEF7560233; Fri, 14 Aug 2015 11:34:34 -0500 (CDT) Received: from localhost (localhost [127.0.0.1]) by smtp-out-2.01.com (Postfix) with ESMTP id C4B0560230; Fri, 14 Aug 2015 11:34:34 -0500 (CDT) X-Virus-Scanned: amavisd-new at smtp-out-2.01.com Received: from smtp.01.com ([127.0.0.1]) by localhost (smtp-out-2.01.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id OC2bVL79vy8Q; Fri, 14 Aug 2015 11:34:34 -0500 (CDT) Received: from [192.168.47.106] (50-1-62-61.dsl.dynamic.fusionbroadband.com [50.1.62.61]) by smtp-out-2.01.com (Postfix) with ESMTPSA id 3690060202; Fri, 14 Aug 2015 11:34:33 -0500 (CDT) Message-ID: <55CE1898.10605@agliodbs.com> Date: Fri, 14 Aug 2015 09:34:32 -0700 From: Josh Berkus Organization: PostgreSQL Experts Inc. User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.8.0 MIME-Version: 1.0 To: Kevin Grittner , "pgsql-performance@postgresql.org" , Jeff Janes Subject: Re: Strange query stalls on replica in 9.3.9 References: <55CCCF4A.2080102@agliodbs.com> <512125623.2442595.1439497468170.JavaMail.yahoo@mail.yahoo.com> In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-performance Precedence: bulk Sender: pgsql-performance-owner@postgresql.org On 08/13/2015 01:24 PM, Kevin Grittner wrote: >> Thing is, the update all rows only takes 2.5 seconds to execute on the >> master. So even if the update is blocking the seq scans on the replica >> (and I can't see why it would), it should only block them for < 3 seconds. > > Visibility hinting and/or hot pruning? Unlikely; I can VACUUM FULL the entire database in 30 seconds. This database is small. Jeff's answer seems more likely ... On 08/13/2015 01:59 PM, Jeff Janes wrote: execute on the > Once the commit of the whole-table update has replayed, the problem > should go way instantly because at that point each backend doing the > seqscan will find the the transaction has committed and so will set the > hint bit that means all of the other seqscan backends that come after it > can skip the proc array scan for that tuple. Yes ... and given that the commit on the master took < 3 seconds, it's not likely to take 30 seconds on the replica. That aside, the pattern of behavior does look similar to the planner issue. > So perhaps the commit of the whole-table update is delayed because the > startup process as also getting bogged down on the same contended lock? > I don't know how hard WAL replay hits the proc array lock. I don't know; we don't have any visibility into the replay process, and no way to tell if replay is waiting on some kind of lock. A regular UPDATE should not block against any select activity on the replay, though. Also, why would this affect *only* the query which does seq scans? Is there some difference between seqscan and index scan here, or is it simply because they take longer, and since this issue is timing-based, they're more likely to be hit? Significantly, the seqscan query is also the most complex query run against the replica, so maybe the seqscan is irrelevant and it's being affected by planner issues? -- Josh Berkus PostgreSQL Experts Inc. http://pgexperts.com -- Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance