Re: [PATCH] Optionally record Plan IDs to track plan changes for a query

2025-01-26 Thread Michael Paquier
On Fri, Jan 24, 2025 at 01:59:00AM -0800, Lukas Fittl wrote: > Overall, I also do wonder if it wouldn't be better to have a callback > mechanism in the shared memory stats, so stats plugins can do extra work > when an entry gets dropped (like freeing the DSA memory for the plan text), > vs having t

Re: [PATCH] Optionally record Plan IDs to track plan changes for a query

2025-01-24 Thread Andrei Lepikhov
On 1/3/25 03:46, Lukas Fittl wrote: My overall perspective is that (1) is best done in-core to keep overhead low, whilst (2) could be done outside of core (or merged with a future pg_stat_statements) and is included here mainly for illustration purposes. Thank you for the patch and your attenti

Re: [PATCH] Optionally record Plan IDs to track plan changes for a query

2025-01-23 Thread Lukas Fittl
On Tue, Jan 21, 2025 at 10:47 AM Artem Gavrilov wrote: > We have another extension that does plan ID tracking: pg_stat_monitor. So > I think it would be great to have this functionality in core. > Thanks! I had forgotten that pg_stat_monitor can optionally track plan statistics. Its actually ano

Re: [PATCH] Optionally record Plan IDs to track plan changes for a query

2025-01-23 Thread Sami Imseih
Thanks for starting this thread. This is an important feature. I am still reviewing, but wanted to share some initial comments. == pg_stat_plans extension (0004) 1. pg_stat_plans_1_0 should not call pgstat_fetch_entry.l This is not needed since we already have the entry with a shared lock and it

Re: [PATCH] Optionally record Plan IDs to track plan changes for a query

2025-01-21 Thread Michael Paquier
On Thu, Jan 02, 2025 at 12:46:04PM -0800, Lukas Fittl wrote: > Inspired by a prior proposal by Sami Imseih for tracking Plan IDs [0], as > well as extensions like pg_stat_plans [1] (unmaintained), pg_store_plans > [2] (not usable on production, see notes later) and aurora_stat_plans [3] > (enabled

Re: [PATCH] Optionally record Plan IDs to track plan changes for a query

2025-01-21 Thread Artem Gavrilov
On Thu, Jan 2, 2025 at 10:47 PM Lukas Fittl wrote: > > The first patch allows use of node jumbling by other unit files / > extensions, which would help an out-of-core extension avoid duplicating all > the node jumbling code. > > The second patch adds a function for the extensible cumulative stati

Re: [PATCH] Optionally record Plan IDs to track plan changes for a query

2025-01-06 Thread Jeremy Schneider
On Thu, 2 Jan 2025 12:46:04 -0800 Lukas Fittl wrote: > this proposed patch set adds: > > 1. An updated in-core facility to optionally track Plan IDs based on > hashing the plan nodes during the existing treewalk in setrefs.c - > controlled by the new "compute_plan_id" GUC > 2. An example user of