Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1f1XtT-0007kV-3e for pgsql-general@arkaria.postgresql.org; Thu, 29 Mar 2018 13:47:07 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1f1XtR-0006DJ-G0 for pgsql-general@arkaria.postgresql.org; Thu, 29 Mar 2018 13:47:05 +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.89) (envelope-from ) id 1f1XtR-0006D3-4s for pgsql-general@lists.postgresql.org; Thu, 29 Mar 2018 13:47:05 +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.89) (envelope-from ) id 1f1XtO-00065K-Sp for pgsql-general@postgresql.org; Thu, 29 Mar 2018 13:47:04 +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 w2TDl1fZ013700; Thu, 29 Mar 2018 09:47:01 -0400 From: Tom Lane To: David Rowley cc: Cory Tucker , "pgsql-general@postgresql.org" Subject: Re: Bad Query Plans on 10.3 vs 9.6 In-reply-to: References: Comments: In-reply-to David Rowley message dated "Thu, 29 Mar 2018 18:56:26 +1300" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <13698.1522331220.1@sss.pgh.pa.us> Date: Thu, 29 Mar 2018 09:47:01 -0400 Message-ID: <13699.1522331221@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk David Rowley writes: > On 29 March 2018 at 18:26, Cory Tucker wrote: >> The plan on 9.6 v 10.3 are effectively identical except in 9.6 the planner >> decides to use an index only scan on the primary key and in 10.3 it does a >> sequential scan. The problem is the sequential scan is for a table of 75M >> rows and 25 columns so its quiet a lot of pages it has to traverse. > How certain are you that all the indexes match on each instance? Another possibility is that 10.3 sees the index-only scan as too expensive because it thinks most of the table isn't all-visible. Comparing pg_class.relallvisible values might be informative. regards, tom lane