Re: compute_query_id and pg_stat_statements - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: compute_query_id and pg_stat_statements
Date
Msg-id 20210426174331.GA19401@alvherre.pgsql
Whole thread Raw
In response to Re: compute_query_id and pg_stat_statements  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: compute_query_id and pg_stat_statements
Re: compute_query_id and pg_stat_statements
List pgsql-hackers
On 2021-Apr-26, Tom Lane wrote:

> Stephen Frost <sfrost@snowman.net> writes:
> > * Magnus Hagander (magnus@hagander.net) wrote:
> >> Thatäs why I suggested the three value one. Default to a mode where
> >> it's automatic, which is what the majority is going to want, but have
> >> a way to explicitly turn it on.
> 
> > This is certainly fine with me too, though it seems a bit surprising to
> > me that we couldn't just figure out what the user actually wants based
> > on what's installed/running for any given combination.
> 
> I'd be on board with having pg_stat_statement's pg_init function do
> something to adjust the setting, if we can figure out how to do that
> in a way that's not confusing in itself.  I'm not sure though that
> the GUC engine offers a good way.

I think it's straightforward, if we decouple the tri-valued enum used
for guc.c purposes from a separate boolean that actually enables the
feature.  GUC sets the boolean to "off" initially when it sees the enum
as "auto", and then pg_stat_statement's _PG_init modifies it during its
own startup as needed.

So the user can turn the GUC off, and then pg_stat_statement does
nothing and there is no performance drawback; or leave it "auto" and
it'll only compute query_id if pg_stat_statement is loaded; or leave it
on if they want the query_id for other purposes.

-- 
Álvaro Herrera                            39°49'30"S 73°17'W
"El miedo atento y previsor es la madre de la seguridad" (E. Burke)



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: compute_query_id and pg_stat_statements
Next
From: Stephen Frost
Date:
Subject: Re: compute_query_id and pg_stat_statements