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
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org, James Coleman <jtc331(at)gmail(dot)com>, Julien Rouhaud <rjuju123(at)gmail(dot)com>, Étienne BERSAC <etienne(dot)bersac(at)dalibo(dot)com>, ashutosh(dot)bapat(dot)oss(at)gmail(dot)com, rafaelthca(at)gmail(dot)com, jian(dot)universality(at)gmail(dot)com, andres(at)anarazel(dot)de
Subject: Re: RFC: Logging plan of the running query
Date: 2024-10-28 13:05:03
Message-ID: 8a8f2432cf5f196f2732ce9e4da7fb89@oss.nttdata.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi

I've recently resumed work on this proposal.

I was revising tests that use the injection point, but given that there
was a recent talk at PGConf.EU about further features based on this
proposal [1], I thought it might be of interest to some. Therefore, I'll
share a patch that removes the injection point section for now.

Due to both the lack of an alternative implementation and the following
comment, I’ve taken the approach of wrapping all plan nodes:

On Tue, Mar 26, 2024 at 11:35 AM Andres Freund andres(at)anarazel(dot)de wrote:
>> Andres, did you have some clever idea for this feature that would
>> avoid the need to do this?
> No. I think it's acceptable though.

As a primary change since the last version, I have added wrapping
processing for child nodes other than left/right tree nodes in response
to the feedback in comment [2].

For nodes other than CustomScanState, I have confirmed via DEBUG logs
that the wrap/unwrap code is being executed. However, I'm still somewhat
uncertain whether CustomScanState should be included in this process.

For testing, I ran below queries in three sessions concurrently during
make installcheck and encountered no issues.

=# select pg_log_query_plan(pid) from pg_stat_activity;
=# \watch 0.1

[1]
https://www.postgresql.eu/events/pgconfeu2024/sessions/session/5689-debugging-active-queries-with-mid-flight-instrumented-explain-plans/
[2]
https://www.postgresql.org/message-id/CA%2BTgmoaaEQtuope6za%3D3GSCZ%2BWJFT4DbF5Cnv0QXFmDnZ_PqFw%40mail.gmail.com

Regards,

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

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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Shubham Khanna 2024-10-28 13:07:26 Re: Pgoutput not capturing the generated columns
Previous Message Daniel Gustafsson 2024-10-28 12:44:40 Re: Inconsistent output handling in 002_pg_upgrade.pl test logs