Re: compute_query_id and pg_stat_statements
Andres Freund <andres@anarazel.de>
From: Andres Freund <andres@anarazel.de>
To: Alvaro Herrera <alvherre@alvh.no-ip.org>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, Stephen Frost <sfrost@snowman.net>, Magnus Hagander <magnus@hagander.net>, Bruce Momjian <bruce@momjian.us>, Christoph Berg <myon@debian.org>, Peter Eisentraut <peter.eisentraut@enterprisedb.com>, Fujii Masao <masao.fujii@oss.nttdata.com>, PostgreSQL Developers <pgsql-hackers@lists.postgresql.org>
Date: 2021-04-26T18:14:08Z
Lists: pgsql-hackers
Hi, On 2021-04-26 13:43:31 -0400, Alvaro Herrera wrote: > 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. I think that's the right direction. I wonder though if we shouldn't go a bit further. Have one guc that determines the "query id provider" (NULL or a shared library), and one GUC that configures whether query-id is computed (never, on-demand/auto, always). For the provider GUC load the .so and look up a function with some well known name. Greetings, Andres Freund
Commits
-
Allow compute_query_id to be set to 'auto' and make it default
- cafde58b337e 14.0 landed
-
Move pg_stat_statements query jumbling to core.
- 5fd9dfa5f50e 14.0 cited