Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jRel5-0005B9-SG for pgsql-performance@arkaria.postgresql.org; Thu, 23 Apr 2020 16:31:27 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jRel4-0004gP-Os for pgsql-performance@arkaria.postgresql.org; Thu, 23 Apr 2020 16:31:26 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jRel4-0004fw-Hu for pgsql-performance@lists.postgresql.org; Thu, 23 Apr 2020 16:31:26 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jRel0-0004D6-MP for pgsql-performance@lists.postgresql.org; Thu, 23 Apr 2020 16:31:25 +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 03NGVGq8014951; Thu, 23 Apr 2020 12:31:16 -0400 From: Tom Lane To: Michael Lewis cc: "David G. Johnston" , Thomas Kellerer , "pgsql-performance@lists.postgresql.org" Subject: Re: PostgreSQL does not choose my indexes well In-reply-to: References: <35dc90d6-e0c2-13b8-3184-e3db5d854a78@gmail.com> <1bb37a19-77f6-8c49-073e-ed6251c98583@gmx.net> <4315.1587655779@sss.pgh.pa.us> Comments: In-reply-to Michael Lewis message dated "Thu, 23 Apr 2020 10:20:41 -0600" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <14949.1587659476.1@sss.pgh.pa.us> Date: Thu, 23 Apr 2020 12:31:16 -0400 Message-ID: <14950.1587659476@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Michael Lewis writes: >> "unless the table is mostly marked all-visible" > Is that taken into account during planning when evaluating index scan vs > sequential scan? It is, although the planner's estimate is based on what the last ANALYZE saw, which might be out-of-date. regards, tom lane