Re: track_planning causing performance regression

Justin Pryzby <pryzby@telsasoft.com>

From: Justin Pryzby <pryzby@telsasoft.com>
To: Fujii Masao <masao.fujii@oss.nttdata.com>
Cc: Pavel Stehule <pavel.stehule@gmail.com>, Peter Geoghegan <pg@bowt.ie>, Julien Rouhaud <rjuju123@gmail.com>, "Tharakan, Robins" <tharar@amazon.com>, pgsql-hackers@postgresql.org
Date: 2021-06-29T02:09:18Z
Lists: pgsql-hackers
On Wed, Apr 21, 2021 at 10:40:07AM -0500, Justin Pryzby wrote:
> On Thu, Apr 22, 2021 at 12:13:17AM +0900, Fujii Masao wrote:
> > On 2021/04/21 23:53, Justin Pryzby wrote:
> > > Or:
> > > 
> > >         Enabling this parameter may incur a noticeable performance penalty,
> > >         especially similar queries are executed by many concurrent connections
> > >         and compete to update a small number of pg_stat_statements entries.
> > 
> > I prefer this. But what about using "identical" instead of "similar"
> > because pg_stat_statements docs already uses "identical" in some places?
> 
> I also missed "when", again...
> 
> > >         Enabling this parameter may incur a noticeable performance penalty,
> > >         especially when queries with identical structure are executed by many concurrent connections
> > >         which compete to update a small number of pg_stat_statements entries.

Checking back - here's the latest patch.

diff --git a/doc/src/sgml/pgstatstatements.sgml b/doc/src/sgml/pgstatstatements.sgml
index 930081c429..9e98472c5c 100644
--- a/doc/src/sgml/pgstatstatements.sgml
+++ b/doc/src/sgml/pgstatstatements.sgml
@@ -696,8 +696,9 @@
       <varname>pg_stat_statements.track_planning</varname> controls whether
       planning operations and duration are tracked by the module.
       Enabling this parameter may incur a noticeable performance penalty,
-      especially when queries with the same queryid are executed on many
-      concurrent connections.
+      especially when queries with identical structure are executed by many
+      concurrent connections which compete to update a small number of
+      pg_stat_statements entries.
       The default value is <literal>off</literal>.
       Only superusers can change this setting.
      </para>



Commits

  1. doc: Fix description about pg_stat_statements.track_planning.

  2. doc: Add note about possible performance overhead by enabling track_planning.

  3. Change default of pg_stat_statements.track_planning to off.