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 1pRdjS-0007cj-MW for pgsql-hackers@arkaria.postgresql.org; Mon, 13 Feb 2023 18:39:18 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pRdjR-0001iZ-Gu for pgsql-hackers@arkaria.postgresql.org; Mon, 13 Feb 2023 18:39:17 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pRdjR-0001iQ-7E for pgsql-hackers@lists.postgresql.org; Mon, 13 Feb 2023 18:39:17 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pRdjO-0004nK-Jz for pgsql-hackers@lists.postgresql.org; Mon, 13 Feb 2023 18:39:15 +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 31DIdDvB1343882; Mon, 13 Feb 2023 13:39:13 -0500 From: Tom Lane To: Richard Guo cc: pgsql-hackers@lists.postgresql.org Subject: Re: Killing off removed rels properly In-reply-to: References: <229905.1676062220@sss.pgh.pa.us> Comments: In-reply-to Richard Guo message dated "Mon, 13 Feb 2023 17:57:49 +0800" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1343880.1676313553.1@sss.pgh.pa.us> Date: Mon, 13 Feb 2023 13:39:13 -0500 Message-ID: <1343881.1676313553@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Richard Guo writes: > On Sat, Feb 11, 2023 at 4:50 AM Tom Lane wrote: >> I think it's time to clean this up by removing the rel from the >> planner data structures altogether. The attached passes check-world, >> and if it does trigger any problems I would say that's a clear >> sign of bugs elsewhere. > +1. The patch looks good to me. Pushed, thanks for looking at it! > One minor comment is that we should > also remove the comments about RELOPT_DEADREL in pathnodes.h. Yeah, I noticed that shortly after posting the patch :-(. Searching the optimizer code for other references to "dead" rels turned up another place where the comments need fixed, namely match_foreign_keys_to_quals ... which is someplace I should have thought to check before, given the reference to it in remove_rel_from_query. Its code is fine as-is though. regards, tom lane