Re: RFC: Logging plan of the running query

torikoshia <torikoshia@oss.nttdata.com>

From: torikoshia <torikoshia@oss.nttdata.com>
To: pgsql-hackers@lists.postgresql.org
Cc: Robert Haas <robertmhaas@gmail.com>, pgsql-hackers@lists.postgresql.org, James Coleman <jtc331@gmail.com>, Julien Rouhaud <rjuju123@gmail.com>, Étienne BERSAC <etienne.bersac@dalibo.com>, ashutosh.bapat.oss@gmail.com, rafaelthca@gmail.com, jian.universality@gmail.com, andres@anarazel.de
Date: 2024-10-28T13:05:03Z
Lists: pgsql-hackers

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. ecpg: Catch zero-length Unicode identifiers correctly

  2. Improve warning message in pg_signal_backend()

  3. Add assert to ensure that page locks don't participate in deadlock cycle.

Attachments

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@anarazel.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.