Re: [Proposal] Adding callback support for custom statistics kinds

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Sami Imseih <samimseih(at)gmail(dot)com>
Cc: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: [Proposal] Adding callback support for custom statistics kinds
Date: 2025-12-04 23:14:58
Message-ID: aTIV8qfcIkht1Hgv@paquier.xyz
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Dec 04, 2025 at 05:00:10PM -0600, Sami Imseih wrote:
> Thanks for the input! Yes, this is a trade-off between putting
> responsibility on the
> extension vs core. The initial thought I had was exactly like yours, but it will
> be easier to get something pushed if we make the core changes as minimal as
> possible. If there are enough complaints in the future, this can be revisited.
> Particularly if there is a common patterns for file cleanup, this
> could be turned
> into a core utility.

Another way to shape it would be to have an in-core routine that
provides a default logic for the actions to take depending on the
write, read or discard state, with the state and a FILE* as arguments.
The main pgstats file would call that, modules may decide to use it.

> However, as discussed off-list, I do think moving the custom kind tests from
> injection points to the new test module is a prerequisite. I rather
> not have us push a new test module that is doing duplicate work as the injection
> stats tests.
> I worked on this refactoring today and plan to have a patch ready for review
> by tomorrow.

Cool, thanks!
--
Michael

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Corey Huinker 2025-12-04 23:40:42 Re: vacuumdb: add --dry-run
Previous Message Corey Huinker 2025-12-04 23:12:16 Re: Re: Extended Statistics set/restore/clear functions.