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
Message-ID: 2838538.1705692747@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
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

[1] https://www.postgresql.org/message-id/flat/149c5c2f-4267-44e3-a177-d1fd24c53f6d%40universite-paris-saclay.fr

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

Responses

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