Re: [PATCH] pgstat: Add helper to drop entries from a stats kind's hash

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Sami Imseih <samimseih(dot)pg(at)gmail(dot)com>
Cc: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>, Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: [PATCH] pgstat: Add helper to drop entries from a stats kind's hash
Date: 2026-10-29 08:26:24
Message-ID: auMDMGzyyXdSXxwm@paquier.xyz
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Oct 28, 2026 at 01:35:47PM -0500, Sami Imseih wrote:
> Yeah, I mentioned that earlier, and I did not feel right about it either. So I
> added back the test that uses pgstat_drop_entry(), and added a separate
> test function for the new _of_kind API. The TAP test now drops one entry via
> pgstat_drop_entry() and another via pgstat_drop_matching_entries_of_kind().
>
> I also renamed the new static helper to pgstat_drop_matching_entries_in_hash()
> to match the existing pgstat_reset_matching_entries_in_hash().

My first reaction after reading this patch is why do we need two APIs?
We could have pgstat_drop_matching_entries() take an additional
PgStat_Kind, matching with all the hash tables if passing an invalid
kind? That would mean one routine instead of three as done in this
patch, as of two exposed and one static in pgstat_shmem.c. That would
also avoid the filter_kind check in the inner loop of
pgstat_drop_matching_entries_in_hash(), as done in the patch.
--
Michael

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message David Geier 2026-10-29 08:26:37 Re: Assert failure in parallel query due to SubPlan double visit for hash join
Previous Message Bertrand Drouvot 2026-10-29 08:23:13 Re: Report buffer access strategies in EXPLAIN