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.89) (envelope-from ) id 1hB3eS-0005Tz-9a for pgsql-hackers@arkaria.postgresql.org; Mon, 01 Apr 2019 20:35:28 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hB3eP-0001sx-Kj for pgsql-hackers@arkaria.postgresql.org; Mon, 01 Apr 2019 20:35:25 +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 1hB3eP-0001sp-8H for pgsql-hackers@lists.postgresql.org; Mon, 01 Apr 2019 20:35:25 +0000 Received: from n3.nabble.com ([162.255.23.22]) by makus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hB3eL-0004uK-R1 for pgsql-hackers@postgresql.org; Mon, 01 Apr 2019 20:35:23 +0000 Received: from n3.nabble.com (localhost [127.0.0.1]) by n3.nabble.com (Postfix) with ESMTP id E4B2312FDF16A for ; Mon, 1 Apr 2019 13:35:19 -0700 (MST) Date: Mon, 1 Apr 2019 13:35:19 -0700 (MST) From: legrand legrand To: pgsql-hackers@postgresql.org Message-ID: <1554150919882-0.post@n3.nabble.com> In-Reply-To: References: <1553718968249-0.post@n3.nabble.com> <1553726396218-0.post@n3.nabble.com> <7091891553759108@iva3-2961a207771d.qloud-c.yandex.net> Subject: Re: Planning counters in pg_stat_statements (using pgss_store) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hi, I have played with this patch, it works fine. rem the last position of the "new" total_time column is confusing +CREATE VIEW pg_stat_statements AS + SELECT *, total_plan_time + total_exec_time AS total_time + FROM pg_stat_statements(true); I wanted to perform some benchmark between those 4 cases: 0 - no pgss, 1 - original pgss (no planning counter and 1 access to pgss hash), 2 - pggs reading querytext in planner hook (* 2 accesses to pgss hash), 3 - pggs reading querytext in parse hook (* 3 accesses to pgss hash) It seems that the difference is so tiny, that there was no other way than running minimal "Select 1;" statement ... ./pgbench -c 10 -j 5 -t 500000 -f select1stmt.sql postgres case avg_tps pct_diff 0 89 278 -- 1 88 745 0,6% 2 88 282 1,1% 3 86 660 2,9% This means that even in this extrem test case, the worst degradation is less than 3% (this overhead can be removed using pg_stat_statements.track_planning guc) notes: - PostgreSQL 12devel on x86_64-w64-mingw32, compiled by gcc.exe (x86_64-win32-sehrev1, Built by MinGW-W64 project) 7.2.0, 64-bit, - cpu usage was less that 95%, - avg_tps is based on 3 runs, - there was a wait of arround 1 minute between each run to keep computer temperature and fan usage low. Regards PAscal -- Sent from: http://www.postgresql-archive.org/PostgreSQL-hackers-f1928748.html