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 1tsS5r-002BzG-P1 for pgsql-hackers@arkaria.postgresql.org; Wed, 12 Mar 2025 19:50:19 +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 1tsS5q-00CEjG-4z for pgsql-hackers@arkaria.postgresql.org; Wed, 12 Mar 2025 19:50:18 +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 1tsS5p-00CEim-Qt for pgsql-hackers@lists.postgresql.org; Wed, 12 Mar 2025 19:50:17 +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 1tsS5n-002U80-2d for pgsql-hackers@lists.postgresql.org; Wed, 12 Mar 2025 19:50:16 +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 52CJo8tt2234936; Wed, 12 Mar 2025 15:50:08 -0400 From: Tom Lane To: Sami Imseih cc: Robert Haas , Jeff Davis , Thom Brown , PostgreSQL Hackers Subject: Re: making EXPLAIN extensible In-reply-to: References: <5bbca514250c1f8ee45f08ada94184b0ae109fe9.camel@j-davis.com> <82f96eed213c8d76b36b8a3f504576e5af493270.camel@j-davis.com> <339167.1741200807@sss.pgh.pa.us> <476382.1741208421@sss.pgh.pa.us> <480078.1741210736@sss.pgh.pa.us> <899469.1741295787@sss.pgh.pa.us> <1056391.1741368807@sss.pgh.p! a.us> Comments: In-reply-to Sami Imseih message dated "Wed, 12 Mar 2025 14:38:06 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2234934.1741809008.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Wed, 12 Mar 2025 15:50:08 -0400 Message-ID: <2234935.1741809008@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Sami Imseih writes: > 1/ As you can see form the output above, I used explain_per_node_hook > to append a "Plan Node ID" to the explain output. I really don't like ha= ving it > there, and prefer that it gets added to the top line of the node. > i.e. > -> Foreign Scan on t_r1 (cost=3D100.00..673.20 rows=3D2560 width=3D= 8) (node_id=3D1) > -> Materialize (cost=3D100.00..686.00 rows=3D2560 width=3D8) (node_= id=3D2) > -> Foreign Scan on t1_r1 (cost=3D100.00..673.20 rows=3D2560 > width=3D8) (node_id=3D3) > Can we add a hook at that point [1] which will allow an extension to mod= ify > the first line of a node? I think this is not just useful for my case, b= ut also > for other use-cases in which some high level node details could be place= d. > what do you think? I think this is a seriously bad idea. The first line is already overloaded; we don't need several different extensions adding more stuff to it. Plus, this doesn't consider what to do in non-text output formats. ISTM you should be good with adding a new "Plan Node ID" property to each node. No, you don't get to put it first. Too bad. (If we did try to cater to that, what shall we do with multiple extensions that all think they should be first?) The validation point is an interesting one. I agree that we don't want the behavior to depend on the order in which options are written. regards, tom lane