| From: | Sami Imseih <samimseih(dot)pg(at)gmail(dot)com> |
|---|---|
| To: | Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | [PATCH] pgstat: Add helper to drop entries from a stats kind's hash |
| Date: | 2026-10-27 21:18:36 |
| Message-ID: | CAN12+YL7SrAwzMpzfNLrVcy=w5L03p7czyO73RfS06kmdqs_fw@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi,
44539786b82 allowed a variable-numbered stats kind to use its own
dshash. One remaining gap is that pgstat_drop_matching_entries() still
scans all variable-numbered stats hash tables, even when the caller
already knows which stats kind it wants.
This patch adds pgstat_drop_matching_entries_of_kind(), a form of
pgstat_drop_matching_entries() that takes a kind. The existing per-hash
drop logic is moved to a static helper, so pgstat_drop_matching_entries()
keeps its current behavior by calling the helper without a kind filter.
Because pgStatLocal.kind_hash[kind] may be the shared variable stats
hash, the helper filters by kind before using the match callback. A nice
side effect is that callers of the new function do not need to repeat the kind
check in their match callbacks.
The test_custom_stats module is adjusted so its existing named drop path
uses the new function with a small match callback.
--
Sami Imseih
Amazon Web Services (AWS)
| Attachment | Content-Type | Size |
|---|---|---|
| v1-0001-pgstat-Add-helper-to-drop-entries-from-a-stats-ki.patch | application/octet-stream | 7.0 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2026-10-27 21:30:34 | Re: [DEPARSE] AT TIME ZONE and similar as a function in FROM do not read back |
| Previous Message | Tomas Vondra | 2026-10-27 20:59:50 | Re: Fix BRIN numeric_minmax_multi_ops out of range value range merging |