Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vNhmC-00BLzh-2G for pgsql-hackers@arkaria.postgresql.org; Tue, 25 Nov 2025 01:23:28 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vNhm9-005lYJ-2l for pgsql-hackers@arkaria.postgresql.org; Tue, 25 Nov 2025 01:23:26 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vNhm9-005lYB-1p for pgsql-hackers@lists.postgresql.org; Tue, 25 Nov 2025 01:23:25 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vNhm7-001Iau-1S for pgsql-hackers@lists.postgresql.org; Tue, 25 Nov 2025 01:23:25 +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 5AP1NIMW1106190; Mon, 24 Nov 2025 20:23:18 -0500 From: Tom Lane To: David Rowley cc: Sergei Glukhov , pgsql-hackers@lists.postgresql.org Subject: Re: Partial hash index is not used for implied qual. In-reply-to: References: Comments: In-reply-to David Rowley message dated "Tue, 25 Nov 2025 13:49:16 +1300" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1106188.1764033798.1@sss.pgh.pa.us> Date: Mon, 24 Nov 2025 20:23:18 -0500 Message-ID: <1106189.1764033798@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk David Rowley writes: > so, that leads me to believe the location you're adjusting is probably > the best place to fix this issue. Wouldn't it be better to handle it more like the is_target_rel logic a few lines further up? I also object to putting the test between the contain_mutable_functions and predicate_implied_by calls; that's both confusing and probably wrong. We're only calling contain_mutable_functions to guard an assumption that predicate_implied_by makes. A larger point is that I think leaving such quals in indrestrictinfo probably distorts our estimates of indexscan costs: we are likely to think they contribute selectivity when they don't. Maybe that's a problem to address separately, but it should be looked at. We skated past the same problem for is_target_rel cases on the grounds that that consideration affects all indexes on the rel equally; but as proposed, this will probably result in an improper bias towards a partial hash index. regards, tom lane