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 1myyq9-0006fw-Kj for pgsql-docs@arkaria.postgresql.org; Sun, 19 Dec 2021 16:15:13 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1myyq6-00040m-JP for pgsql-docs@arkaria.postgresql.org; Sun, 19 Dec 2021 16:15:10 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1myyq6-00040d-C0 for pgsql-docs@lists.postgresql.org; Sun, 19 Dec 2021 16:15:10 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1myyq4-0002QQ-3v for pgsql-docs@lists.postgresql.org; Sun, 19 Dec 2021 16:15:09 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 1BJGF3mv1881496; Sun, 19 Dec 2021 11:15:03 -0500 From: Tom Lane To: seakintruth@gmail.com cc: pgsql-docs@lists.postgresql.org Subject: Re: One of the example queries that 'could' is identical to one that 'could not'. In-reply-to: <163991655494.26053.16534427118514526140@wrigleys.postgresql.org> References: <163991655494.26053.16534427118514526140@wrigleys.postgresql.org> Comments: In-reply-to PG Doc comments form message dated "Sun, 19 Dec 2021 12:22:34 +0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1881494.1639930503.1@sss.pgh.pa.us> Date: Sun, 19 Dec 2021 11:15:03 -0500 Message-ID: <1881495.1639930503@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk PG Doc comments form writes: > 11.9.2 lists ```SELECT x FROM tab WHERE x = 'key' AND z < 42;``` as both > examples of 'could' and 'could not' use index-only scans. No, look again: one of the queries uses the indexed column y, and the other uses the non-indexed column z. regards, tom lane