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 1lhON3-0005pP-0o for pgsql-hackers@arkaria.postgresql.org; Fri, 14 May 2021 03:20:13 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lhON1-00037w-2H for pgsql-hackers@arkaria.postgresql.org; Fri, 14 May 2021 03:20:11 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lhON0-00037n-Qk for pgsql-hackers@lists.postgresql.org; Fri, 14 May 2021 03:20:10 +0000 Received: from oss.nttdata.com ([49.212.34.109]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lhOMx-00040A-KV for pgsql-hackers@lists.postgresql.org; Fri, 14 May 2021 03:20:10 +0000 Received: from hnk.local (p2388012-ipbf1027funabasi.chiba.ocn.ne.jp [118.6.6.12]) by oss.nttdata.com (Postfix) with ESMTPSA id B4C73604CB; Fri, 14 May 2021 12:20:00 +0900 (JST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.2 at oss.nttdata.com Subject: Re: compute_query_id and pg_stat_statements To: Alvaro Herrera , Julien Rouhaud Cc: Pavel Stehule , Kyotaro Horiguchi , Magnus Hagander , Michael Paquier , Andres Freund , Tom Lane , Stephen Frost , Bruce Momjian , Christoph Berg , Peter Eisentraut , PostgreSQL Hackers References: <20210514000437.GA14223@alvherre.pgsql> From: Fujii Masao Message-ID: <63caca55-a48b-a8b4-9c17-814a7106e035@oss.nttdata.com> Date: Fri, 14 May 2021 12:20:00 +0900 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: <20210514000437.GA14223@alvherre.pgsql> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2021/05/14 9:04, Alvaro Herrera wrote: > Here's a first attempt at what was suggested. If you say "auto" it > remains auto in SHOW, but it gets enabled if a module asks for it. > > Not final yet, but I thought I'd throw it out for early commentary ... Many thanks! The patch basically looks good to me. +void +EnableQueryId(void) +{ + if (compute_query_id == COMPUTE_QUERY_ID_AUTO) + auto_query_id_enabled = true; Shouldn't EnableQueryId() enable auto_query_id_enabled whatever compute_query_id is? Otherwise, for example, the following scenario can happen and it's a bit strange. 1. The server starts up with shared_preload_libraries=pg_stat_statements and compute_query_id=on 2. compute_query_id is set to auto and the configuration file is reloaded Then, even though compute_query_id is auto and pg_stat_statements is loaded, query ids are not computed and no queries are tracked by pg_stat_statements. Regards, -- Fujii Masao Advanced Computing Technology Center Research and Development Headquarters NTT DATA CORPORATION