Re: Explain and filter over subplans

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Chantal Keller <chantal(dot)keller(at)universite-paris-saclay(dot)fr>
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Explain and filter over subplans
Date: 2024-01-18 17:55:40
Message-ID: 2289721.1705600540@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Chantal Keller <chantal(dot)keller(at)universite-paris-saclay(dot)fr> writes:
> I would like "explain" to output formulas for filtering over
> subplans. Is it possible?

No, and that's been a to-do item for a long time.

Currently, EXPLAIN just ignores the "testexpr" field of SubPlan
nodes, which is what you are after. We could print it, if we
could figure out an intelligible representation. In the example
you give, the testexpr would probably render as "t.a >= $0"
where $0 represents the subplan's output column.

A very rough sketch, perhaps, is that instead of just
"(SubPlan 1)", we could print "(ALL t.a >= $0 FROM SubPlan 1)".
Some of the other SubLinkTypes might be harder to represent
in a way that makes sense to users.

I made a quick-hack patch to play with, if you're interested.

regards, tom lane

Attachment Content-Type Size
wip-show-subplan-testexpr-in-explain.patch text/x-diff 1.8 KB

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Martin Ritchie 2024-01-18 19:26:05 Re: Tips on troubleshooting slow DELETE (suspect cascades)
Previous Message Jim Vanns 2024-01-18 17:03:51 Re: Tips on troubleshooting slow DELETE (suspect cascades)