Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cTe1V-0005rw-EG for pgsql-general@arkaria.postgresql.org; Wed, 18 Jan 2017 00:22:45 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1cTe1U-0008Gb-UI for pgsql-general@arkaria.postgresql.org; Wed, 18 Jan 2017 00:22:44 +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_2) (envelope-from ) id 1cTe1U-0008GU-BT for pgsql-general@postgresql.org; Wed, 18 Jan 2017 00:22:44 +0000 Received: from smtp3.hushmail.com ([65.39.178.200]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1cTe1O-00080Q-Jo for pgsql-general@postgresql.org; Wed, 18 Jan 2017 00:22:43 +0000 Received: from smtp3.hushmail.com (localhost [127.0.0.1]) by smtp3.hushmail.com (Postfix) with SMTP id 9EE26E03E1 for ; Wed, 18 Jan 2017 00:22:34 +0000 (UTC) Received: from smtp.hushmail.com (w3.hushmail.com [65.39.178.62]) by smtp3.hushmail.com (Postfix) with ESMTP; Wed, 18 Jan 2017 00:22:33 +0000 (UTC) Subject: Re: Queries are taking way longer in 9.6 than 9.5 To: Tomas Vondra , Ravi Tammineni References: <70190c66-cf64-4741-1cd7-a6cf08f4101f@2ndquadrant.com> Cc: "pgsql-general@postgresql.org" From: Chris Mair Message-ID: Date: Wed, 18 Jan 2017 01:22:29 +0100 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:45.0) Gecko/20100101 Thunderbird/45.6.0 MIME-Version: 1.0 In-Reply-To: <70190c66-cf64-4741-1cd7-a6cf08f4101f@2ndquadrant.com> Content-Type: text/plain; charset=windows-1252; format=flowed 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-general Precedence: bulk Sender: pgsql-general-owner@postgresql.org On 17/01/17 23:21, Tomas Vondra wrote: > Hi, > > after looking at the explain plans again, I very much doubt those come from the same query. The reason is the 9.5 plan contains this part: > > -> HashAggregate (cost=67.54..68.12 rows=192 width=4) > Group Key: d.vip_patient_id > -> Nested Loop (cost=0.17..67.44 rows=192 width=4) > -> Index Scan using unq_user_name on tblcnaccounts ... > Index Cond: ((user_name)::text = 'dddddd'::text) > -> Index Only Scan using idx_tblcndoctorpatientmap ... > Index Cond: (master_user_id = a.master_user_id) > > while the 9.6 plan does not include anything like that, i.e. there's only a single aggregate at the top level, without any group keys. Also, the SQL query you've provided does not include any GROUP BY clause, so I claim that those plans are from two different queries. There's also a user_name = 'dddddd' that has become a user_name = 'rdoyleda' ... Ravi, could you please send the current query you're testing and the explain analyze of that query on 9.5 and 9.6? Bye, Chris. -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general