Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VOWdu-0000Jk-95 for pgsql-performance@arkaria.postgresql.org; Tue, 24 Sep 2013 17:43:22 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1VOWdt-0007PQ-Pa for pgsql-performance@arkaria.postgresql.org; Tue, 24 Sep 2013 17:43:21 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VOWdr-0007PH-KI for pgsql-performance@postgresql.org; Tue, 24 Sep 2013 17:43:19 +0000 Received: from smtp.01.com ([199.36.142.181]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VOWdj-0004lC-Dt for pgsql-performance@postgresql.org; Tue, 24 Sep 2013 17:43:19 +0000 Received: from localhost (localhost [127.0.0.1]) by smtp-out-1.01.com (Postfix) with ESMTP id 0F8FA29409F for ; Tue, 24 Sep 2013 12:43:10 -0500 (CDT) X-Virus-Scanned: amavisd-new at smtp-out-1.01.com Received: from smtp.01.com ([127.0.0.1]) by localhost (smtp-out-1.01.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id oXKyBS8UJUCK for ; Tue, 24 Sep 2013 12:43:09 -0500 (CDT) Received: from smtp.01.com (localhost [127.0.0.1]) by smtp-out-1.01.com (Postfix) with ESMTP id E34362940A4 for ; Tue, 24 Sep 2013 12:43:09 -0500 (CDT) Received: from localhost (localhost [127.0.0.1]) by smtp-out-1.01.com (Postfix) with ESMTP id D5DA92940A2 for ; Tue, 24 Sep 2013 12:43:09 -0500 (CDT) X-Virus-Scanned: amavisd-new at smtp-out-1.01.com Received: from smtp.01.com ([127.0.0.1]) by localhost (smtp-out-1.01.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id o5uV-A-KPo1s for ; Tue, 24 Sep 2013 12:43:09 -0500 (CDT) Received: from [172.47.23.102] (50-1-86-157.dsl.dynamic.sonic.net [50.1.86.157]) by smtp-out-1.01.com (Postfix) with ESMTPSA id 7378229409F for ; Tue, 24 Sep 2013 12:43:09 -0500 (CDT) Message-ID: <5241CF2A.2070309@agliodbs.com> Date: Tue, 24 Sep 2013 10:43:06 -0700 From: Josh Berkus Organization: PostgreSQL Experts Inc. User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130803 Thunderbird/17.0.8 MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Re: Planner performance extremely affected by an hanging transaction (20-30 times)? References: <1379944816.30390.YahooMailNeo@web162903.mail.bf1.yahoo.com> <5815.1380018947@sss.pgh.pa.us> In-Reply-To: X-Enigmail-Version: 1.5.2 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -1.9 (-) 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 09/24/2013 08:01 AM, jesper@krogh.cc wrote: > This stuff is a 9.2 feature right? What was the original problem to be > adressed? Earlier, actually. 9.1? 9.0? The problem addressed was that, for tables with a "progressive" value like a sequence or a timestamp, the planner tended to estimate 1 row any time the user queried the 10,000 most recent rows due to the stats being out-of-date. This resulted in some colossally bad query plans for a very common situation. So there's no question that the current behavior is an improvement, since it affects *only* users who have left an idle transaction open for long periods of time, something you're not supposed to do anyway. Not that we shouldn't fix it (and backport the fix), but we don't want to regress to the prior planner behavior. However, a solution is not readily obvious: On 09/24/2013 03:35 AM, Tom Lane wrote: > Kevin Grittner writes: >> > Are we talking about the probe for the end (or beginning) of an >> > index? If so, should we even care about visibility of the row >> > related to the most extreme index entry? Should we even go to the >> > heap during the plan phase? > Consider the case where some transaction inserted a wildly out-of-range > value, then rolled back. If we don't check validity of the heap row, > we'd be using that silly endpoint value for planning purposes --- > indefinitely. That's not an improvement over the situation that the > probe is meant to fix. Agreed. And I'll also attest that the patch did fix a chronic bad planner issue. On 09/20/2013 03:01 PM, Jeff Janes wrote:> 3) Even worse, asking if a given transaction has finished yet can be a > serious point of system-wide contention, because it takes the > ProcArrayLock, once per row which needs to be checked. So you have 20 > processes all fighting over the ProcArrayLock, each doing so 1000 times per > query. Why do we need a procarraylock for this? Seems like the solution would be not to take a lock at all; the information on transaction commit is in the clog, after all. -- 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