On Tue, Jan 14, 2025 at 5:08 PM Luca Ferrari <fluca1...@gmail.com> wrote: > > In the file backend/executor/execMain.c there are the following hook types: > > /* Hooks for plugins to get control in ExecutorStart/Run/Finish/End */ > ExecutorStart_hook_type ExecutorStart_hook = NULL; > ExecutorRun_hook_type ExecutorRun_hook = NULL; > ExecutorFinish_hook_type ExecutorFinish_hook = NULL; > ExecutorEnd_hook_type ExecutorEnd_hook = NULL; >
> Moreover, installing an hook is cluster-wide, right? Is there a way to > limit an hook only for connections related to a single database > (without taking into account FDW and friends)? > > Thanks, > Luca > module contrib/pg_stat_statements/pg_stat_statements.c using these hooks. in a Database cluster create extension pg_stat_statements in db A, not create pg_stat_statements in db B. then you can do an experiment by using gdb or add elog(INFO,,,,) at the end of pgss_ExecutorStart. then see the effect.