Re: compute_query_id and pg_stat_statements

From: Julien Rouhaud <rjuju123(at)gmail(dot)com>
To: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>
Cc: magnus(at)hagander(dot)net, masao(dot)fujii(at)oss(dot)nttdata(dot)com, michael(at)paquier(dot)xyz, andres(at)anarazel(dot)de, tgl(at)sss(dot)pgh(dot)pa(dot)us, alvherre(at)alvh(dot)no-ip(dot)org, sfrost(at)snowman(dot)net, bruce(at)momjian(dot)us, myon(at)debian(dot)org, peter(dot)eisentraut(at)enterprisedb(dot)com, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: compute_query_id and pg_stat_statements
Date: 2021-05-13 03:23:17
Message-ID: 20210513032317.e5dpno3bfwwrpwro@nol
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, May 13, 2021 at 12:11:12PM +0900, Kyotaro Horiguchi wrote:
> At Thu, 13 May 2021 10:43:03 +0800, Julien Rouhaud <rjuju123(at)gmail(dot)com> wrote in
> > On Thu, May 13, 2021 at 11:26:29AM +0900, Kyotaro Horiguchi wrote:
> > >
> > > I believe any "real"
> > > alternative query-id provider is supposed to be hooked "before"
> > > pg_stat_statements. (It is a kind of magic to control the order of
> > > plugins, though..
> >
> > Indeed, you have to configure shared_preload_libraries depending on whether
> > each module calls the previous post_parse_analyze_hook before or after its own
> > processing, and that's the main reason why I think a dedicated entry point
> > would be better.
>
> I see it as cleaner than the status-quo. (But still believing less
> cleaner than DLL:p, since the same problem happens if two
> query_id-generating modules are competing on the new hook ponit.).
>
> You told that a special query-id provider needed to be separated to
> another DLL

No, I'm saying a different entry point. It can be a new hook or an explicit
function name called for a dynamically loaded function, I'm fine with both as
long as it's called before post_parse_analyze_hook.

> It seems like the only problem doing that is we don't have a means to
> call per-process intializer for a preload libralies.

But that's going to happen only once per backend? If it's still adding too
much overhead you could add the module in shared_preload_libraries.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2021-05-13 03:26:06 Re: PG 14 release notes, first draft
Previous Message Julien Rouhaud 2021-05-13 03:16:13 Re: compute_query_id and pg_stat_statements