Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.92) (envelope-from ) id 1jHSy4-0004f7-Dl for pgsql-hackers@arkaria.postgresql.org; Thu, 26 Mar 2020 13:54:44 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1jHSy3-0001zz-5j for pgsql-hackers@arkaria.postgresql.org; Thu, 26 Mar 2020 13:54:43 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1jHSy2-0001zq-QC for pgsql-hackers@lists.postgresql.org; Thu, 26 Mar 2020 13:54:42 +0000 Received: from oss.nttdata.com ([49.212.34.109]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jHSxz-0002uX-U7 for pgsql-hackers@postgresql.org; Thu, 26 Mar 2020 13:54:41 +0000 Received: from hnk.local (sp49-97-92-76.msc.spmode.ne.jp [49.97.92.76]) by oss.nttdata.com (Postfix) with ESMTPSA id 2F57D6063C; Thu, 26 Mar 2020 22:54:36 +0900 (JST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.102.2 at oss.nttdata.com Subject: Re: Patch: to pass query string to pg_plan_query() To: legrand legrand , pgsql-hackers@postgresql.org References: <1583789487074-0.post@n3.nabble.com> From: Fujii Masao Message-ID: <6ecbaaca-5a8e-5fe6-f7e1-a893e708bd7b@oss.nttdata.com> Date: Thu, 26 Mar 2020 22:54:35 +0900 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0) Gecko/20100101 Thunderbird/68.6.0 MIME-Version: 1.0 In-Reply-To: <1583789487074-0.post@n3.nabble.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2020/03/10 6:31, legrand legrand wrote: > Hello, > > This is a call for committers, reviewers and users, > regarding "planning counters in pg_stat_statements" > patch [1] but not only. Does anyone object to this patch? I'm thinking to commit it separetely at first before committing the planning_counter_in_pg_stat_statements patch. > Historically, this version of pg_stat_statements > with planning counters was performing 3 calls to > pgss_store() for non utility statements in: > 1 - pgss_post_parse_analyze (init entry with queryid > and store query text) > 2 - pgss_planner_hook (to store planning counters) > 3 - pgss_ExecutorEnd (to store execution counters) > > Then a new version was proposed to remove one call > to pgss_store() by adding the query string to the > planner pg_plan_query(): But pgss_store() still needs to be called three times even in non-utility command if the query has constants. Right? > 1 - pgss_planner_hook (to store planning counters) > 2 - pgss_ExecutorEnd (to store execution counters) > > Many performances tests where performed concluding > that there is no impact on this subject. Sounds good! > Patch "to pass query string to the planner", could be > committed by itself, and (maybe) used by other extensions. > > If this was done, this new version of pgss with planning > counters could be committed as well, or even later > (being used as a non core extension starting with pg13). > > So please give us your feedback regarding this patch > "to pass query string to the planner", if you have other > use cases, or any comment regarding core architecture. *As far as I heard*, pg_hint_plan extension uses very tricky way to extract query string in the planner hook. So this patch would be very helpful to make pg_hint_plan avoid using such tricky way. Regards, -- Fujii Masao NTT DATA CORPORATION Advanced Platform Technology Group Research and Development Headquarters