Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e1IMg-0000ql-BD for pgsql-performance@arkaria.postgresql.org; Sun, 08 Oct 2017 20:39:58 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1e1IMe-0001xe-Qh for pgsql-performance@arkaria.postgresql.org; Sun, 08 Oct 2017 20:39:56 +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 1e1IKu-0007G6-7n for pgsql-performance@postgresql.org; Sun, 08 Oct 2017 20:38:08 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1e1IKn-0000ig-F9 for pgsql-performance@postgresql.org; Sun, 08 Oct 2017 20:38:06 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id v98KbxZD013827; Sun, 8 Oct 2017 16:37:59 -0400 From: Tom Lane To: Jim Nasby cc: "pgsql-performance@postgresql.org" Subject: Re: Regression from 9.4-9.6 In-reply-to: References: <5d7c0f80-3767-1531-d911-197fcc147173@nasby.net> <11434.1507491291@sss.pgh.pa.us> Comments: In-reply-to Jim Nasby message dated "Sun, 08 Oct 2017 15:02:42 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <13825.1507495079.1@sss.pgh.pa.us> Date: Sun, 08 Oct 2017 16:37:59 -0400 Message-ID: <13826.1507495079@sss.pgh.pa.us> 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 Jim Nasby writes: > On 10/8/17 2:34 PM, Tom Lane wrote: >> Why has this indexscan's cost estimate changed so much? > Great question... the only thing that sticks out is the coalesce(). Let > me see if an analyze with a higher stats target changes anything. FWIW, > the 9.6 database is copied from the 9.4 one once a week and then > pg_upgraded. I'm pretty sure an ANALYZE is part of that process. Hm, now that I see the SubPlan in there, I wonder whether 9.6 is accounting more conservatively for the cost of the subplan. It probably is assuming that the subplan gets run for each row fetched from the index, although the loops and rows-removed counts show that the previous filter conditions reject 99% of the fetched rows. But that code looks the same in 9.4, so I don't understand why the 9.4 estimate isn't equally large ... regards, tom lane -- Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance