Re: compute_query_id and pg_stat_statements - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: compute_query_id and pg_stat_statements
Date
Msg-id 20210424170908.GM7629@momjian.us
Whole thread Raw
In response to Re: compute_query_id and pg_stat_statements  (Magnus Hagander <magnus@hagander.net>)
Responses Re: compute_query_id and pg_stat_statements  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Sat, Apr 24, 2021 at 06:48:53PM +0200, Magnus Hagander wrote:
> > I think the query overhead was too high (2%) to enable it by default:
> >
> >         https://www.postgresql.org/message-id/20201016160355.GA31474@alvherre.pgsql
> 
> Personally I'd say 2% is not too high to turn it on by default, as it
> goes down when you move past trivial queries, which is what most
> people do. And since you can easily turn it off.

We would do a lot of work to reduce overhead by 2% on every query, and
to add 2% for a hash that previously was only used by pg_stat_statements
seems unwise.

> How about turning it into an enum instead of a boolean, that can be:
> 
> off = always off
> auto = pg_stat_statments turns it on when it's loaded in
> shared_preload_libraries. Other extensions using it can do that to.
> But it remains off if you haven't installed any *extension* that needs
> it
> on = always on (if you want it in pg_stat_activity regardless of extensions)
> 
> The default would be "auto", which means that pg_stat_statements would
> work as expected, but those who haven't installed it (or another
> extension that changes it) would not have to pay the overhead.

That's a pretty weird API.  I think we just need people to turn it on
like they are doing when the configure pg_stat_statements anyway. 
pg_stat_statements already requires configuration anyway.

-- 
  Bruce Momjian  <bruce@momjian.us>        https://momjian.us
  EDB                                      https://enterprisedb.com

  If only the physical world exists, free will is an illusion.




pgsql-hackers by date:

Previous
From: Magnus Hagander
Date:
Subject: Re: compute_query_id and pg_stat_statements
Next
From: Tom Lane
Date:
Subject: Re: compute_query_id and pg_stat_statements