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 07:42:20
Message-ID: 20210513074220.emx4dy4ow3zbp2ij@nol
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, May 13, 2021 at 04:15:30PM +0900, Kyotaro Horiguchi wrote:
> >
> > what if you want to have some other extensions like pg_stat_kcache or
> > pg_store_plans that need a query_id but don't really care if
> > pg_stat_statements is enabled or not? should they all declare their own
>
> Thanks for looking it.
>
> The addtional provider function in pg_stat_statements is just an
> example to show what if it needs its own query-id provider, which is
> useless in reality. In reality pg_stat_statements just calls
> "queryIdWanted("default", true)" to use any query-id provider and use
> the in-core one as the fallback implement, and no need to define its
> own one.
>
> Any extension can use the in-core provider and accepting any other
> ones by calling queryIdWanted("default", true) then get what they want
> regardless of existence of pg_stat_statements.

I see, thanks for the clarification. So I looked a bit at the implementation,
mostly the new queryIdWanted() and check_query_id_provider(), it seems a bit
inconsistent.

It's not clear to me how this should be used. It seems that it's designed to
allow any plugin to activate a query_id implementation, but if a third-party
query_id provider tries to activate its own implementation it will fail if you
also want to use pg_stat_statements as both will try to activate incompatible
implementations. It seems to me that queryIdWanted() should only be used for
enabling core query_id if the configuration allows the core implementation to
be enabled, and everything else should be manually configured by users, so
there shouldn't be a provider_name.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Etsuro Fujita 2021-05-13 08:00:22 Re: Inherited UPDATE/DELETE vs async execution
Previous Message Michael Paquier 2021-05-13 07:27:47 Re: Teaching users how they can get the most out of HOT in Postgres 14