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 1tNj34-001k4u-6q for pgsql-bugs@arkaria.postgresql.org; Wed, 18 Dec 2024 01:40:26 +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 1tNj33-008hQg-Cb for pgsql-bugs@arkaria.postgresql.org; Wed, 18 Dec 2024 01:40:25 +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 1tNj33-008hQX-46 for pgsql-bugs@lists.postgresql.org; Wed, 18 Dec 2024 01:40:24 +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.94.2) (envelope-from ) id 1tNj30-0007nI-Ib for pgsql-bugs@lists.postgresql.org; Wed, 18 Dec 2024 01:40:23 +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 4BI1eLYq2549069; Tue, 17 Dec 2024 20:40:21 -0500 From: Tom Lane To: David Rowley cc: Dmytro Astapov , pgsql-bugs@lists.postgresql.org Subject: Re: Surprising SeqScan of appendRel that can't contribute any rows to the result In-reply-to: References: Comments: In-reply-to David Rowley message dated "Wed, 18 Dec 2024 13:08:10 +1300" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2549067.1734486021.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Tue, 17 Dec 2024 20:40:21 -0500 Message-ID: <2549068.1734486021@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk David Rowley writes: > On Wed, 18 Dec 2024 at 12:17, Dmytro Astapov wrote: >> Surprisingly, this does SeqScan on partB in NestedLoops over some_ids w= ith a filter `some_ids.id =3D NULL::bigint`: > TL;DR is it's not a bug and expected behaviour. The particular case shown here might be fixable by re-applying eval_const_expressions after we've derived the pushed-down qual. Most of the time that'd be a waste of cycles though, and I'm not sure how often it would help. regards, tom lane