Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1laK6z-0002x9-Mt for pgsql-hackers@arkaria.postgresql.org; Sat, 24 Apr 2021 15:22:25 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1laK6y-0000U5-MS for pgsql-hackers@arkaria.postgresql.org; Sat, 24 Apr 2021 15:22:24 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1laK6y-0000Ty-Bu for pgsql-hackers@lists.postgresql.org; Sat, 24 Apr 2021 15:22:24 +0000 Received: from momjian.us ([72.94.173.45]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1laK6w-0002Yo-8M for pgsql-hackers@lists.postgresql.org; Sat, 24 Apr 2021 15:22:23 +0000 Received: from bruce by momjian.us with local (Exim 4.92) (envelope-from ) id 1laK6u-0001ph-N0; Sat, 24 Apr 2021 11:22:20 -0400 Date: Sat, 24 Apr 2021 11:22:20 -0400 From: Bruce Momjian To: Fujii Masao Cc: pgsql-hackers@lists.postgresql.org Subject: Re: compute_query_id and pg_stat_statements Message-ID: <20210424152220.GL7629@momjian.us> References: <35457b09-36f8-add3-1d07-6034fa585ca8@oss.nttdata.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <35457b09-36f8-add3-1d07-6034fa585ca8@oss.nttdata.com> User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Sat, Apr 24, 2021 at 11:54:25PM +0900, Fujii Masao wrote: > When compute_query_id is not enabled (this is the default setting), > pg_stat_statements doesn't track any statements. This means that > we will see no entries in pg_stat_statements by default. I'm afraid that > users may easily forget to enable compute_query_id > when using pg_stat_statements (because this setting was not necessary > in v13 or before), and finally may have noticed the mis-configuration > and failure of statements tracking after many queries were executed. > For example, we already have one report about this issue, in [1]. > > Shouldn't we do something so that users can avoid such mis-configuration? > > One idea is to change the default value of compute_query_id from false to true. > If enabling compute_query_id doesn't incur any performance penalty, > IMO this idea is very simple and enough. I think the query overhead was too high (2%) to enable it by default: https://www.postgresql.org/message-id/20201016160355.GA31474@alvherre.pgsql > Another idea is to change pg_stat_statements so that it emits an error > at the server startup (i.e., prevents the server from starting up) > if compute_query_id is not enabled. In this case, users can easily notice > the mis-configuration from the error message in the server log, > enable compute_query_id, and then restart the server. I think it throws an error in the server logs, but preventing server start seems extreme. Also, compute_query_id is PGC_SUSET, meaning it can be changed by the super-user, so you could enable compute_query_id without a server restart, which makes failing on start kind of odd. -- Bruce Momjian https://momjian.us EDB https://enterprisedb.com If only the physical world exists, free will is an illusion.