Improving EXPLAIN's display of SubPlan nodes

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Cc: Chantal Keller <chantal(dot)keller(at)universite-paris-saclay(dot)fr>
Subject: Improving EXPLAIN's display of SubPlan nodes
Date: 2024-01-19 19:32:27
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

EXPLAIN has always been really poor at displaying SubPlan nodes
in expressions: you don't get much more than "(SubPlan N)".
This is mostly because every time I thought about it, I despaired
of trying to represent all the information in a SubPlan accurately.
However, a recent discussion[1] made me realize that we could do
a lot better just by displaying the SubLinkType and the testexpr
(if relevant). So here's a proposed patch. You can see what
it does by examining the regression test changes.

There's plenty of room to bikeshed about exactly how to display
this stuff, and I'm open to suggestions.

BTW, I was somewhat depressed to discover that we have exactly
zero regression coverage of the ROWCOMPARE_SUBLINK code paths;
not only was EXPLAIN output not covered, but the planner and
executor too. So I added some simple tests for that. Otherwise
I think existing coverage is enough for this.

regards, tom lane


Attachment Content-Type Size
v1-0001-Improve-EXPLAIN-s-display-of-SubPlan-nodes.patch text/x-diff 36.2 KB


Browse pgsql-hackers by date

  From Date Subject
Next Message Majid Garoosi 2024-01-19 19:34:50 GUC-ify walsender MAX_SEND_SIZE constant
Previous Message David G. Johnston 2024-01-19 18:53:03 Re: PG12 change to DO UPDATE SET column references