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 1eqnGS-0000Nj-9i for pgsql-general@arkaria.postgresql.org; Tue, 27 Feb 2018 21:58:24 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1eqnGQ-0001Xp-Dc for pgsql-general@arkaria.postgresql.org; Tue, 27 Feb 2018 21:58:22 +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.89) (envelope-from ) id 1eqnGQ-0001Xe-52 for pgsql-general@lists.postgresql.org; Tue, 27 Feb 2018 21:58:22 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1eqnGI-0005Y3-R3 for pgsql-general@postgresql.org; Tue, 27 Feb 2018 21:58:21 +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 w1RLwB5b028386; Tue, 27 Feb 2018 16:58:11 -0500 From: Tom Lane To: "David G. Johnston" cc: Hadi Moshayedi , Postgres General Subject: Re: index-only-scan when there is an index on all columns In-reply-to: References: <25619.1519765684@sss.pgh.pa.us> Comments: In-reply-to "David G. Johnston" message dated "Tue, 27 Feb 2018 14:18:52 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <28384.1519768691.1@sss.pgh.pa.us> Date: Tue, 27 Feb 2018 16:58:11 -0500 Message-ID: <28385.1519768691@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk "David G. Johnston" writes: > If one runs vacuum on a table (small or otherwise) that is currently > choosing an index scan as its best plan how likely is it that post-vacuum > an index-only plan would be chosen if the index type and column presence > conditions are met? Offhand I think it would always prefer IOS over regular indexscan if the table is mostly all-visible. The problem in this example was that other choices dominate both. > Also, I recall discussion that select statements will touch the visibility > map (hence causing write I/O even in a read-only query) but [1] indicates > that only vacuum will set them ddl will clear them. Hm, I don't recall that, but I've not been involved in the last few rounds of hacking on that mechanism. regards, tom lane