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 1tt8LE-0090AW-Nu for pgsql-bugs@arkaria.postgresql.org; Fri, 14 Mar 2025 16:57:00 +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 1tt8LB-00BgD2-OO for pgsql-bugs@arkaria.postgresql.org; Fri, 14 Mar 2025 16:56:57 +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 1tt8LB-00BgCq-FI for pgsql-bugs@lists.postgresql.org; Fri, 14 Mar 2025 16:56:57 +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 1tt8L9-002poW-1b for pgsql-bugs@lists.postgresql.org; Fri, 14 Mar 2025 16:56:56 +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 52EGusxn3086085; Fri, 14 Mar 2025 12:56:54 -0400 From: Tom Lane To: joan@sanchezsabe.com cc: pgsql-bugs@lists.postgresql.org Subject: Re: BUG #18851: Queries with xxx NOT IN (SELECT xxx FROM table) fail to run (or run very slowly) on v17 (v14 ok) In-reply-to: <18851-5a0a9801290135d7@postgresql.org> References: <18851-5a0a9801290135d7@postgresql.org> Comments: In-reply-to PG Bug reporting form message dated "Fri, 14 Mar 2025 16:16:06 -0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3086083.1741971414.1@sss.pgh.pa.us> Date: Fri, 14 Mar 2025 12:56:54 -0400 Message-ID: <3086084.1741971414@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: > I have experienced a misbehaviour (IMHO) in PostgreSQL 17 that didn't occur > in PostgreSQL 14. What have you got work_mem set to in the two installations? For me, both versions switch to the cheap hashed plan if work_mem is large enough that the inner table is estimated to fit in it (somewhere around 10MB-20MB for this specific example). If anything the newer code seems to have a smaller threshold. regards, tom lane