Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cU52H-0000Gf-4N for pgsql-general@arkaria.postgresql.org; Thu, 19 Jan 2017 05:13:21 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1cU52G-0000aF-GR for pgsql-general@arkaria.postgresql.org; Thu, 19 Jan 2017 05:13:20 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1cU4zv-0006Qr-VJ for pgsql-general@postgresql.org; Thu, 19 Jan 2017 05:10:56 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1cU4zs-0001EK-NJ for pgsql-general@postgresql.org; Thu, 19 Jan 2017 05:10:54 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 074B62099C; Thu, 19 Jan 2017 00:10:52 -0500 (EST) Received: from frontend1 ([10.202.2.160]) by compute6.internal (MEProxy); Thu, 19 Jan 2017 00:10:52 -0500 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=aklaver.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc:x-sasl-enc; s=mesmtp; bh=7rpIxS8uK3Z/kak GSnizexFoFj0=; b=UvrGwZ8PkaMOYeywJ88ZzUt7+E84U9TTL1xwj+tp9lwWfVV X7/IpdbBu05eNSk3jeVbBMXXAbv3Ltt5Ir1N/2chGXl+ntIXx5EjUz4TpxNYR15t V6vo3i759Nd7GYW0CUUVyigXu1zJQINLSkOwWDO8acsihVVgQ7XTufDCXH7Y= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s= smtpout; bh=7rpIxS8uK3Z/kakGSnizexFoFj0=; b=rWUxbYBFZRJw3zG5Rbff zwpxu37YqO4/Y63kpFdunUk1u2TAZ6/Gu/83ArmptPH1/jMV5htqP7Bqd2ppz2bC +ags44xZwembJqEeWHn3I+MRlc25CkUm03EBpODtUlSKbAy/KJNWL1JzkSkQ15eN gwEdHNDOoYQeN1Pmm8M3B7I= X-ME-Sender: X-Sasl-enc: JlAfLLAzccJ2gjih+FldjgrIY4tfR7TVVyZl0Dnl7zOr 1484802651 Received: from [192.168.1.2] (174-21-203-58.tukw.qwest.net [174.21.203.58]) by mail.messagingengine.com (Postfix) with ESMTPA id 2BC1C7E351; Thu, 19 Jan 2017 00:10:51 -0500 (EST) Subject: Re: Queries are taking way longer in 9.6 than 9.5 To: Merlin Moncure , Melvin Davidson References: <70190c66-cf64-4741-1cd7-a6cf08f4101f@2ndquadrant.com> Cc: Ravi Tammineni , Chris Mair , Tomas Vondra , "pgsql-general@postgresql.org" From: Adrian Klaver Message-ID: Date: Wed, 18 Jan 2017 21:10:50 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -2.7 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-general Precedence: bulk Sender: pgsql-general-owner@postgresql.org On 01/18/2017 08:58 PM, Merlin Moncure wrote: > On Wed, Jan 18, 2017 at 2:12 PM, Melvin Davidson > wrote: > > > > On Wed, Jan 18, 2017 at 3:06 PM, Merlin Moncure > wrote: > > On Wed, Jan 18, 2017 at 1:04 PM, Ravi Tammineni > > wrote: > > Hi Chris, > > > > Here is the query and execution plan in 9.5 and 9.6. > > Can you verify tblpuorderstatus and tblpuorderstatushistory have all > indexes accounted for on both servers? It seems incredible server > would prefer wading through 11M records to 1298 nestloop. I'm > curious > what plans you get if you try playing around with: > > set enable_seqscan=false; > set enable_hashjoin=false; > > ...but I think we have two possibilities here: > 1. schema mismatch > 2. planner bug > > merlin > > > -- > Sent via pgsql-general mailing list > (pgsql-general@postgresql.org ) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgsql-general > > > > *I never got an answer to my question. > * > *Have you verified that postgresql.conf is the same of both 9.5 & 9.6?* > > > This is not verified, but I can't think of an influential planner > variable that would push planner cost from 2600 to millions; abrupt > increase in plan cost roles out a knife edge plan choice and the > statistic look relatively correct on rows. Unless planner choices are > disabled in postgresql.conf, this suggests something is preventing > planner from choosing a particular kind of plan for this query, which is > suggesting bug to me. I am still working out the parallel query feature in 9.6 but I am seeing the below in the 9.6 EXPLAIN ANALYZE: -> Gather (cost=1000.00..3011004.71 rows=529690 width=4) (actual time=2.713..368445.460 rows=595653 loops=1) Workers Planned: 2 Workers Launched: 2 Does that not indicate parallel query has been turned on? Would not turning it off be a better apple-to-apple comparison to the 9.5 plan? > > OP, if you want to contribute to the investigation of fix, "git bisect" > is the way to proceed...is that feasible? > > merlin -- Adrian Klaver adrian.klaver@aklaver.com -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general