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
Date: 2022-09-08T10:19:09Z
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 →
-
ecpg: Catch zero-length Unicode identifiers correctly
- a18b6d2dc288 15.0 cited
-
Improve warning message in pg_signal_backend()
- 7fa945b857cc 15.0 cited
-
Add assert to ensure that page locks don't participate in deadlock cycle.
- 72e78d831ab5 13.0 cited
Attachments
- v23-0001-log-running-query-plan.patch (text/x-diff) patch v23-0001
On 2022-05-16 17:02, torikoshia wrote: > On 2022-03-09 19:04, torikoshia wrote: >> On 2022-02-08 01:13, Fujii Masao wrote: >>> AbortSubTransaction() should reset ActiveQueryDesc to >>> save_ActiveQueryDesc that ExecutorRun() set, instead of NULL? >>> Otherwise ActiveQueryDesc of top-level statement will be unavailable >>> after subtransaction is aborted in the nested statements. >> >> I once agreed above suggestion and made v20 patch making >> save_ActiveQueryDesc a global variable, but it caused segfault when >> calling pg_log_query_plan() after FreeQueryDesc(). >> >> OTOH, doing some kind of reset of ActiveQueryDesc seems necessary >> since it also caused segfault when running pg_log_query_plan() during >> installcheck. >> >> There may be a better way, but resetting ActiveQueryDesc to NULL seems >> safe and simple. >> Of course it makes pg_log_query_plan() useless after a subtransaction >> is aborted. >> However, if it does not often happen that people want to know the >> running query's plan whose subtransaction is aborted, resetting >> ActiveQueryDesc to NULL would be acceptable. >> >> Attached is a patch that sets ActiveQueryDesc to NULL when a >> subtransaction is aborted. >> >> How do you think? Attached new patch to fix patch apply failures again. -- Regards, -- Atsushi Torikoshi NTT DATA CORPORATION