pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Julien Rouhaud <rjuju123@gmail.com>
To: Andres Freund <andres@anarazel.de>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Alvaro Herrera <alvherre@alvh.no-ip.org>
Cc: Stephen Frost <sfrost@snowman.net>
Cc: Magnus Hagander <magnus@hagander.net>
Cc: Bruce Momjian <bruce@momjian.us>
Cc: Christoph Berg <myon@debian.org>
Cc: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
Cc: Fujii Masao <masao.fujii@oss.nttdata.com>
Cc: PostgreSQL Developers <pgsql-hackers@lists.postgresql.org>
Subject: Re: compute_query_id and pg_stat_statements
Date: Tue, 27 Apr 2021 14:25:04 +0800
Message-ID: <20210427062504.ofz3rgedbrl5bep2@nol> (raw)
In-Reply-To: <20210426183745.4gd2s5qra6mlxfto@alap3.anarazel.de>
References: <2268611.1619458140@sss.pgh.pa.us>
	<20210426174331.GA19401@alvherre.pgsql>
	<20210426181408.3j6kkzpxnadpwptv@alap3.anarazel.de>
	<2295572.1619461260@sss.pgh.pa.us>
	<20210426183745.4gd2s5qra6mlxfto@alap3.anarazel.de>

On Mon, Apr 26, 2021 at 11:37:45AM -0700, Andres Freund wrote:
> Hi,
> 
> On 2021-04-26 14:21:00 -0400, Tom Lane wrote:
> > Andres Freund <andres@anarazel.de> writes:
> > That's sounding like a pretty sane design, actually.  Not sure about
> > the shared-library-name-with-fixed-function-name detail, but certainly
> > it seems to be useful to separate "I need a query-id" from the details
> > of the ID calculation.
> > 
> > Rather than a GUC per se for the ID provider, maybe we could have a
> > function hook that defaults to pointing at the in-core computation,
> > and then a module wanting to override that just gets into the hook.
> 
> I have a preference to determining the provider via GUC instead of a
> hook because it is both easier to introspect and easier to configure.

In any case, having a different provider would greatly simplify third-party
queryid lib authors and users life.  For now the core queryid is computed
before post_parse_analyze_hook, but any third party plugin would have to do it
as a post_parse_analyze_hook, so you have to make sure that the lib is at the
right position in shared_preload_libraries to have it work, eg. [1], depending
on how pg_stat_statements and other similar module call
prev_post_parse_analyze_hook, which is a pretty bad thing.

> If the provider is loaded via a hook, and the shared library is loaded
> via shared_preload_libraries, one can't easily just turn that off in a
> single session, but needs to restart or explicitly load a different
> library (that can't already be loaded).

On the other hand we *don't* want to dynamically change the provider.
Temporarily enabling/disabling queryid calculation is ok, but generating
different have for the same query isn't.

> We also don't have any way to show what's hooking into a hook.

If we had a dedicated query_id hook, then plugins should error out if users
configured multiple plugins to calculate a query_id, so it should be easy to
know which plugin is responsible for it without knowing who hooked into the
hook.

[1] https://github.com/rjuju/pg_queryid/blob/master/pg_queryid.c#L116-L117





view thread (158+ messages)  latest in thread

Message-ID: <20210427062504.ofz3rgedbrl5bep2@nol>
Permalink:  ../20210427062504.ofz3rgedbrl5bep2@nol/
Also on:    postgresql.org/message-id/20210427062504.ofz3rgedbrl5bep2@nol

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: rjuju123@gmail.com, andres@anarazel.de, tgl@sss.pgh.pa.us, alvherre@alvh.no-ip.org, sfrost@snowman.net, magnus@hagander.net, bruce@momjian.us, myon@debian.org, peter.eisentraut@enterprisedb.com, masao.fujii@oss.nttdata.com, pgsql-hackers@lists.postgresql.org
  Subject: Re: compute_query_id and pg_stat_statements
  In-Reply-To: <20210427062504.ofz3rgedbrl5bep2@nol>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox