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 1jH5n1-0004MF-QZ for pgsql-hackers@arkaria.postgresql.org; Wed, 25 Mar 2020 13:09:47 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1jH5n0-0001eq-LN for pgsql-hackers@arkaria.postgresql.org; Wed, 25 Mar 2020 13:09:46 +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 1jH5n0-0001ej-8Y for pgsql-hackers@lists.postgresql.org; Wed, 25 Mar 2020 13:09:46 +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 1jH5mw-0007Ry-Sa for pgsql-hackers@postgresql.org; Wed, 25 Mar 2020 13:09:45 +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 4EAF960587; Wed, 25 Mar 2020 22:09:38 +0900 (JST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.102.2 at oss.nttdata.com Subject: Re: Planning counters in pg_stat_statements (using pgss_store) To: Julien Rouhaud , Sergei Kornilov Cc: "imai.yoshikazu@fujitsu.com" , legrand legrand , "pgsql-hackers@postgresql.org" References: <1584180240397-0.post@n3.nabble.com> <20200314172733.mg7qpyumlyythm25@nol> <20200316214912.iakenhp7vyd37hmg@nol> <6300601584711975@vla4-87a00c2d2b1b.qloud-c.yandex.net> <20200320193004.rqgf3iim4fugq3sm@nol> From: Fujii Masao Message-ID: Date: Wed, 25 Mar 2020 22:09:37 +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: <20200320193004.rqgf3iim4fugq3sm@nol> 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: Precedence: bulk On 2020/03/21 4:30, Julien Rouhaud wrote: > On Fri, Mar 20, 2020 at 05:09:05PM +0300, Sergei Kornilov wrote: >> Hello >> >> Yet another is missed in docs: total_time > > Oh good catch! I rechecked many time the field, and totally missed that the > documentation is referring to the view, which has an additional column, and not > the function. Attached v9 fixes that. Thanks for the patch! Here are the review comments from me. - PGSS_V1_3 + PGSS_V1_3, + PGSS_V1_8 WAL usage patch [1] increments this version to 1_4 instead of 1_8. I *guess* that's because previously this version was maintained independently from pg_stat_statements' version. For example, pg_stat_statements 1.4 seems to have used PGSS_V1_3. + /* + * We can't process the query if no query_text is provided, as pgss_store + * needs it. We also ignore query without queryid, as it would be treated + * as a utility statement, which may not be the case. + */ Could you tell me why the planning stats are not tracked when executing utility statements? In some utility statements like REFRESH MATERIALIZED VIEW, the planner would work. +static BufferUsage +compute_buffer_counters(BufferUsage start, BufferUsage stop) +{ + BufferUsage result; BufferUsageAccumDiff() has very similar logic. Isn't it better to expose and use that function rather than creating new similar function? values[i++] = Int64GetDatumFast(tmp.rows); values[i++] = Int64GetDatumFast(tmp.shared_blks_hit); values[i++] = Int64GetDatumFast(tmp.shared_blks_read); Previously (without the patch) pg_stat_statements_1_3() reported the buffer usage counters updated only in execution phase. But, in the patched version, pg_stat_statements_1_3() reports the total of buffer usage counters updated in both planning and execution phases. Is this OK? I'm not sure how seriously we should ensure the backward compatibility for pg_stat_statements.... +/* contrib/pg_stat_statements/pg_stat_statements--1.7--1.8.sql */ ISTM it's good timing to have also pg_stat_statements--1.8.sql since the definition of pg_stat_statements() is changed. Thought? [1] https://postgr.es/m/CAB-hujrP8ZfUkvL5OYETipQwA=e3n7oqHFU=4ZLxWS_Cza3kQQ@mail.gmail.com Regards, -- Fujii Masao NTT DATA CORPORATION Advanced Platform Technology Group Research and Development Headquarters