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 1qgeRf-00GcpD-Qn for pgsql-bugs@arkaria.postgresql.org; Thu, 14 Sep 2023 04:59:16 +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 1qgeRd-005iMy-St for pgsql-bugs@arkaria.postgresql.org; Thu, 14 Sep 2023 04:59:13 +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 1qgeRc-005iMW-UO for pgsql-bugs@lists.postgresql.org; Thu, 14 Sep 2023 04:59:13 +0000 Received: from wnew3-smtp.messagingengine.com ([64.147.123.17]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qgeRV-004SUH-5a for pgsql-bugs@lists.postgresql.org; Thu, 14 Sep 2023 04:59:11 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailnew.west.internal (Postfix) with ESMTP id 6A2E62B00164; Thu, 14 Sep 2023 00:59:02 -0400 (EDT) Received: from imap53 ([10.202.2.103]) by compute1.internal (MEProxy); Thu, 14 Sep 2023 00:59:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastmail.com; h= cc:cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm2; t=1694667541; x=1694668141; bh=Wk esk4zxcsbaT6o0gxJGLZl9UZ1oAaX7adZCOMNH1KE=; b=orAj18AV3E7nI81mfI mJ1vxzAPupZyrXaNCgWp6DxmaFXNlLL8BIZ+baAA6K4k5lBv8WXUDkVveVbiF13I 7Hulz9RmTB0faoB+Gitad8UjezbB6IhjSzWV+dLmHAQNgsJjOmtxH4Ys6vDGPiwv onU1tVNWRGLtRMdCnOAmwsD5EvUduPuBqA2ApM3fmNMNehTpKKQWibFtveohk3xy 6bmmFXCaqCzCusNNtoHojjrTEoDuO1GA87UnNJscAI0G7O2cUXNBBwF0UYTxwHEY n2KE6IBW+BMR/VEzzsoiLnwJnxHTB3pXLM4OhpJ8NIzLvXn+zAICGVW6Eppg8Fl4 olLQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=i80a949e3.fm2; t=1694667541; x=1694668141; bh=Wke sk4zxcsbaT6o0gxJGLZl9UZ1oAaX7adZCOMNH1KE=; b=FFS1tIttSWVRbvGjQ7p 0xilK5dJfgcrraWvW2B5NhMQiXLVW27cUxf7rrArdAtVyMVUvGF6sxBCj45GVcWw WCOimGVeBqwj1++jFz3SjRHlwvOtNeMjrSkKSL1YhrNv6CcmeKs/bue8rRPOIowT ywftOMCTukTrFBwgNQraPv3pCXGOMenqqQtryRiyG1uPpXOQSME4BZ7PHI9akhMC gDHZI3ZVfhkDLhq8GIPDSl9iiC1HB1Qi5iWib4qDJ8LUkS5gN6859IuujinIvdgC K2HQG0clZfCguiJiysCWyGM7LOj9gptNw/fHzgQVcjvp3EZAwNo+XJVVR2nnUCVm 7hg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedrudeiledgkeekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefofgggkfgjfhffhffvvefutgesth dtredtreertdenucfhrhhomhepfdfnvghpihhkhhhovhcutehnughrvghifdcuoehlvghp ihhkhhhovhesfhgrshhtmhgrihhlrdgtohhmqeenucggtffrrghtthgvrhhnpeeuleetfe egfeejueekfffhieegffehgeelhedvtdelhfegveefgeefteevhfehjeenucevlhhushht vghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehlvghpihhkhhhovhesfh grshhtmhgrihhlrdgtohhm X-ME-Proxy: Feedback-ID: i80a949e3:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id 06BA1880060; Thu, 14 Sep 2023 00:59:01 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.9.0-alpha0-745-g95dd7bea33-fm-20230905.001-g95dd7bea Mime-Version: 1.0 Message-Id: <545bcd8f-7789-4054-bea1-44e2584a305a@app.fastmail.com> In-Reply-To: References: Date: Thu, 14 Sep 2023 11:58:39 +0700 From: "Lepikhov Andrei" To: "Richard Guo" Cc: pgsql-bugs@lists.postgresql.org, "Tom Lane" , =?UTF-8?Q?=D0=90=D0=BB=D0=B5=D0=BD=D0=B0_=D0=A0=D1=8B=D0=B1=D0=B0=D0=BA?= =?UTF-8?Q?=D0=B8=D0=BD=D0=B0?= , =?UTF-8?Q?=D0=94=D0=B0=D0=BC=D0=B8=D1=80_=D0=91=D0=B5=D0=BB=D1=8F=D0=BB?= =?UTF-8?Q?=D0=BE=D0=B2?= Subject: Re: EXPLAIN Verbose issue - custom_scan_tlist can directly refer CTE and Subquery Content-Type: text/plain List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon, Sep 11, 2023, at 1:28 PM, Richard Guo wrote: > Maybe we can use the first plan in CustomScan->custom_plans as the INNER > referent? I'm not sure. After some exploration of ruleutils.c I grasped more on this issue. If we have come to the CTE or SubPlan entry by the INDEX_VAR link from custom_scan_tlist, we don't have any information on which subplan to go further (entry info already removed because of optimization). To find a specific subplan, we must pass through the custom node subtree and find CteScan or SubqueryScan, whose target list refers to this entry. After that, we can go into the subplan to correctly explain the var. It looks like a lot of work. One vague idea is to change set_customscan_references and wrap up CustomScan with useful data. Or, maybe it is better not to try to go under the custom_scan_tlist and explain CTE and Subquery right on the level of the CustomScan? -- Regards, Andrei Lepikhov