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.94.2) (envelope-from ) id 1tn5Xd-001vvQ-PP for pgsql-bugs@arkaria.postgresql.org; Wed, 26 Feb 2025 00:44:50 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1tn5Xb-00BkX3-Ri for pgsql-bugs@arkaria.postgresql.org; Wed, 26 Feb 2025 00:44:47 +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.94.2) (envelope-from ) id 1tn5Xb-00BkWK-JN for pgsql-bugs@lists.postgresql.org; Wed, 26 Feb 2025 00:44:47 +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 1tn5XX-0005g1-2R for pgsql-bugs@lists.postgresql.org; Wed, 26 Feb 2025 00:44:46 +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 51Q0igVX1678856; Tue, 25 Feb 2025 19:44:42 -0500 From: Tom Lane To: nico@cryptonector.com cc: pgsql-bugs@lists.postgresql.org Subject: Re: BUG #18825: Row value equality predicates do not use indices In-reply-to: <18825-5c25a6ba19fa6549@postgresql.org> References: <18825-5c25a6ba19fa6549@postgresql.org> Comments: In-reply-to PG Bug reporting form message dated "Tue, 25 Feb 2025 22:24:36 +0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1678854.1740530682.1@sss.pgh.pa.us> Date: Tue, 25 Feb 2025 19:44:42 -0500 Message-ID: <1678855.1740530682@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk PG Bug reporting form writes: > DELETE FROM foo USING (SELECT dels FROM dels) AS dels > WHERE foo = dels; -- <--- does not use indices on either table [ shrug... ] Works for me given the full-row indexes, although I do have to force enable_seqscan off or reduce random_page_cost a lot, because otherwise the planner thinks a seqscan-and-sort is cheaper. I strongly suspect it's right, because full-row indexes are going to be bigger than the table proper. The mere fact that a plan uses indexes does not automatically make it better than one that doesn't. Anyway, AFAICS your gripe has nothing to do with "can the planner use these indexes", and everything to do with its cost estimates about the value of doing it that way. regards, tom lane