Re: RFC: Logging plan of the running query

From: torikoshia <torikoshia(at)oss(dot)nttdata(dot)com>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org, robertmhaas(at)gmail(dot)com
Cc: Atsushi Torikoshi <torikoshia(dot)tech(at)gmail(dot)com>, samimseih(at)gmail(dot)com, destrex271(at)gmail(dot)com
Subject: Re: RFC: Logging plan of the running query
Date: 2025-05-20 13:17:59
Message-ID: cbd51ca25cf1f754e008aaea3d58c86c@oss.nttdata.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, Apr 5, 2025 at 3:14 PM Atsushi Torikoshi
<torikoshia(dot)tech(at)gmail(dot)com> wrote:
> On Thu, Apr 3, 2025 at 11:10 PM Robert Haas <robertmhaas(at)gmail(dot)com>
> wrote:
>> Do we really need ExecProcNodeOriginal? Can we find some way to reuse
>> ExecProcNodeReal instead of making the structure bigger?

> I also wanted to implement this without adding elements to PlanState if
> possible, but I haven't found a good solution, so the patch uses
> ExecSetExecProcNode.

I tackled this again and the attached patch removes ExecProcNodeOriginal
from Planstate.
Instead of adding a new field, this version builds the behavior into the
existing wrapper function, ExecProcNodeFirst().

Since ExecProcNodeFirst() is already handling instrumentation-related
logic, the patch has maybe become a bit more complex to accommodate both
that and the new behavior.

While it might make sense to introduce a more general mechanism that
allows for stacking an arbitrary number of wrappers around ExecProcNode,
I’m not sure it's possible or worth the added complexity—such layered
wrapping doesn't seem like something we typically need.

What do you think?

--
Regards,

--
Atsushi Torikoshi
Seconded from NTT DATA GROUP CORPORATION to SRA OSS K.K.

Attachment Content-Type Size
v45-0001-Add-function-to-log-the-plan-of-the-currently-ru.patch text/x-diff 38.6 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Langote 2025-05-20 13:25:41 Re: generic plans and "initial" pruning
Previous Message Nazir Bilal Yavuz 2025-05-20 12:46:44 Re: PG 18 release notes draft committed