Re: Improving EXPLAIN's display of SubPlan nodes
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Dean Rasheed <dean.a.rasheed@gmail.com>
Cc: Aleksander Alekseev <aleksander@timescale.com>,
pgsql-hackers@lists.postgresql.org,
Chantal Keller <chantal.keller@universite-paris-saclay.fr>
Date: 2024-03-16T17:25:07Z
Lists: pgsql-hackers
Attachments
- v3-0001-Improve-EXPLAIN-s-display-of-SubPlan-nodes.patch (text/x-diff) patch v3-0001
I wrote: > Dean Rasheed <dean.a.rasheed@gmail.com> writes: >> One thing that concerns me about making even greater use of "$n" is >> the potential for confusion with generic plan parameters. > True. After looking at your draft some more, it occurred to me that we're not that far from getting rid of showing "$n" entirely in this context. Instead of (subplan_name).$n, we could write something like (subplan_name).colN or (subplan_name).columnN or (subplan_name).fN, depending on your taste for verboseness. "fN" would correspond to the names we assign to columns of anonymous record types, but it hasn't got much else to recommend it. In the attached I used "colN"; "columnN" would be my next choice. You could also imagine trying to use the sub-SELECT's actual output column names, but I fear that would be ambiguous --- too often it'd be "?column?" or some other non-unique name. > Hmm. I guess what bothers me about that is that it could be read to > suggest that the initplan or subplan is evaluated again for each > output parameter. This objection seems like it could be solved through documentation, so I wrote some. The attached proof-of-concept is incomplete: it fails to replace some $n occurrences with subplan references, as is visible in some of the test cases. I believe your quick hack in get_parameter() is not correct in detail, but for the moment I didn't bother to debug it. I'm just presenting this as a POC to see if this is the direction people would like to go in. If there's not objections, I'll try to make a bulletproof implementation. regards, tom lane
Commits
-
Improve EXPLAIN's display of SubPlan nodes and output parameters.
- fd0398fcb099 17.0 landed