Re: Add support for entry counting in pgstats

2025-10-18 Thread Sami Imseih
Thanks for this patch! > I have looked at what can be done, and finished with a rather simple > approach, as we have only one code path when a new entry is inserted, > and one code path when an entry is removed when the refcount of an > entry reaches 0 (includes resets, drops for kind matches, etc

Re: Add support for entry counting in pgstats

2025-09-28 Thread Michael Paquier
On Fri, Sep 26, 2025 at 12:09:45PM -0500, Sami Imseih wrote: > Thanks for v3. The only remaining comment I have is: Thanks for the extra lookup. I have fixed this one, incorporated the feedback from Chao, and applied the result after more tests with pgbench to check the state of the counter. Wit

Re: Add support for entry counting in pgstats

2025-09-27 Thread Sami Imseih
Thanks for v3. The only remaining comment I have is: This comment seems unnecessary, since refcount is not checked inside pgstat_free_entry, but earlier. + /* +* Entry has been dropped with refcount at 0, hence decrement the +* entry counter. +*/ I would just say th

Re: Add support for entry counting in pgstats

2025-09-25 Thread Michael Paquier
with the field name entry_counts, and it's true that using the plural form is confusing. How about track_entry_count in PgStat_KindInfo instead? -- Michael From 4761314ce27f8aaebaa531e8068513cf9924680b Mon Sep 17 00:00:00 2001 From: Michael Paquier Date: Fri, 26 Sep 2025 12:53:27 +0900 Subject: [PATCH

Re: Add support for entry counting in pgstats

2025-09-25 Thread Sami Imseih
> On Tue, Sep 23, 2025 at 01:39:00PM -0500, Sami Imseih wrote: > > The refcount reaches 0 when all backends release their references to the > > stat, so if something like pg_stat_statements relies on a count for > > deallocation purposes (to stay within the max), and that value only > > decrements

Re: Add support for entry counting in pgstats

2025-09-24 Thread Michael Paquier
7:23 +0900 Subject: [PATCH v2 1/2] Add support for entry counting in pgstats Stats kinds can set an option call track_counts, that will make pgstats track the number of entries that exist in the shared hashtable. As there is only one code path where a new entry is added, and one code path wher

Re: Add support for entry counting in pgstats

2025-09-23 Thread Keisuke Kuroda
Testing via the Injection Point has been successfully completed. > The option is named track_counts. Regarding the option name track_counts in PgStat_KindInfo. In my personal opinion, I was just wondering that it shares the same name as the GUC track_counts(pgstat_track_counts in the source code).

Re: Add support for entry counting in pgstats

2025-09-23 Thread Michael Paquier
On Tue, Sep 23, 2025 at 01:39:00PM -0500, Sami Imseih wrote: > The refcount reaches 0 when all backends release their references to the > stat, so if something like pg_stat_statements relies on a count for > deallocation purposes (to stay within the max), and that value only > decrements when all r

Re: Add support for entry counting in pgstats

2025-09-12 Thread Chao Li
> On Sep 12, 2025, at 15:23, Michael Paquier wrote: > > > -- > Michael > <0001-Add-support-for-entry-counting-in-pgstats.patch><0002-injection_points-Add-entry-counting.patch> The code overall looks good to me, very clear and neat. Just a few small comments: 1 - 0001 ``` +* set. T

Add support for entry counting in pgstats

2025-09-12 Thread Michael Paquier
test. Thoughts are welcome. -- Michael From 0c924a72f586c385f6ab1a22174b9c3b1cf2dd08 Mon Sep 17 00:00:00 2001 From: Michael Paquier Date: Fri, 12 Sep 2025 16:09:51 +0900 Subject: [PATCH 1/2] Add support for entry counting in pgstats Stats kinds can set an option call track_counts, that will make pg