Re: compute_query_id and pg_stat_statements
Bruce Momjian <bruce@momjian.us>
From: Bruce Momjian <bruce@momjian.us>
To: Julien Rouhaud <rjuju123@gmail.com>
Cc: Pavel Stehule <pavel.stehule@gmail.com>, Kyotaro Horiguchi <horikyota.ntt@gmail.com>, Magnus Hagander <magnus@hagander.net>, Fujii Masao <masao.fujii@oss.nttdata.com>, Michael Paquier <michael@paquier.xyz>, Andres Freund <andres@anarazel.de>, Tom Lane <tgl@sss.pgh.pa.us>, Alvaro Herrera <alvherre@alvh.no-ip.org>, Stephen Frost <sfrost@snowman.net>, Christoph Berg <myon@debian.org>, Peter Eisentraut <peter.eisentraut@enterprisedb.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2021-05-13T03:06:52Z
Lists: pgsql-hackers
On Thu, May 13, 2021 at 09:57:00AM +0800, Julien Rouhaud wrote: > On Wed, May 12, 2021 at 09:13:25PM -0400, Bruce Momjian wrote: > > On Thu, May 13, 2021 at 08:52:36AM +0800, Julien Rouhaud wrote: > > > > > > Well, as implemented you can get the value of compute_query_id, and if it's > > > still "auto" then it's not enabled as calling queryIdWanted() would turn it to > > > on. I agree that it's not ideal but you have a way to know. We could document > > > that auto means that it's set to auto and no one asked to automatically enabled > > > it. > > > > Wow, so the extension changes it? > > Yes. It seemed better to go this way rather than having a secondary read-only > GUC for that. > > > How do we record the "source" of that > > change? Do we have other GUCs that do that? > > No, we don't. But I don't know what exactly you would like to have as a OK. > source? What if you have for instance pg_stat_statements, pg_stat_kcache, > pg_store_plans and pg_wait_sampling installed? All those extensions need a > query_id (or at least benefit from it for pg_wait_sampling), is there any value > to give a full list of all the modules that would enable compute_query_id? Well, we don't have any other cases where the source of the change is this indeterminate, so I don't really have a suggestion. I think this does highlight another case where 'auto' just isn't a good fit for our API. > I'm assuming that anyone wanting to install any of those extensions (or any > similar one) is fully aware that they aggregate metrics based on at least a > query_id. If they don't, well they probably never read any documentation since > postgres 9.2 which introduced query normalization, and I doubt that they will > be interested in having access to the information anyway. My point is that we are changing a setting from an extension, and if you look in pg_setting, it will say "default"? If the user already has to edit postgresql.conf to set shared_preload_libraries, I still don't see why having them set compute_query_id at the same time is a significant problem and a reason to distort our API to do 'auto'. -- Bruce Momjian <bruce@momjian.us> https://momjian.us EDB https://enterprisedb.com If only the physical world exists, free will is an illusion.
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