Skip to content

Commit d1763ea

Browse files
committed
Change default of pg_stat_statements.track_planning to off.
Since v13 pg_stat_statements is allowed to track the planning time of statements when track_planning option is enabled. Its default was on. But this feature could cause more terrible spinlock contentions in pg_stat_statements. As a result of this, Robins Tharakan reported that v13 beta1 showed ~45% performance drop at high DB connection counts (when compared with v12.3) during fully-cached SELECT-only test using pgbench. To avoid this performance regression by the default setting, this commit changes default of pg_stat_statements.track_planning to off. Back-patch to v13 where pg_stat_statements.track_planning was introduced. Reported-by: Robins Tharakan Author: Fujii Masao Reviewed-by: Julien Rouhaud Discussion: https://postgr.es/m/2895b53b033c47ccb22972b589050dd9@EX13D05UWC001.ant.amazon.com
1 parent 947456a commit d1763ea

File tree

4 files changed

+18
-3
lines changed

4 files changed

+18
-3
lines changed

contrib/pg_stat_statements/expected/pg_stat_statements.out

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ CREATE EXTENSION pg_stat_statements;
33
-- simple and compound statements
44
--
55
SET pg_stat_statements.track_utility = FALSE;
6+
SET pg_stat_statements.track_planning = TRUE;
67
SELECT pg_stat_statements_reset();
78
pg_stat_statements_reset
89
--------------------------

contrib/pg_stat_statements/pg_stat_statements.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,7 @@ _PG_init(void)
442442
"Selects whether planning duration is tracked by pg_stat_statements.",
443443
NULL,
444444
&pgss_track_planning,
445-
true,
445+
false,
446446
PGC_SUSET,
447447
0,
448448
NULL,

contrib/pg_stat_statements/sql/pg_stat_statements.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ CREATE EXTENSION pg_stat_statements;
44
-- simple and compound statements
55
--
66
SET pg_stat_statements.track_utility = FALSE;
7+
SET pg_stat_statements.track_planning = TRUE;
78
SELECT pg_stat_statements_reset();
89

910
SELECT 1 AS "int";

doc/src/sgml/pgstatstatements.sgml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@
101101
</para>
102102
<para>
103103
Number of times the statement was planned
104+
(if <varname>pg_stat_statements.track_planning</varname> is enabled,
105+
otherwise zero)
104106
</para></entry>
105107
</row>
106108

@@ -110,6 +112,8 @@
110112
</para>
111113
<para>
112114
Total time spent planning the statement, in milliseconds
115+
(if <varname>pg_stat_statements.track_planning</varname> is enabled,
116+
otherwise zero)
113117
</para></entry>
114118
</row>
115119

@@ -119,6 +123,8 @@
119123
</para>
120124
<para>
121125
Minimum time spent planning the statement, in milliseconds
126+
(if <varname>pg_stat_statements.track_planning</varname> is enabled,
127+
otherwise zero)
122128
</para></entry>
123129
</row>
124130

@@ -128,6 +134,8 @@
128134
</para>
129135
<para>
130136
Maximum time spent planning the statement, in milliseconds
137+
(if <varname>pg_stat_statements.track_planning</varname> is enabled,
138+
otherwise zero)
131139
</para></entry>
132140
</row>
133141

@@ -137,6 +145,8 @@
137145
</para>
138146
<para>
139147
Mean time spent planning the statement, in milliseconds
148+
(if <varname>pg_stat_statements.track_planning</varname> is enabled,
149+
otherwise zero)
140150
</para></entry>
141151
</row>
142152

@@ -145,7 +155,10 @@
145155
<structfield>stddev_plan_time</structfield> <type>double precision</type>
146156
</para>
147157
<para>
148-
Population standard deviation of time spent planning the statement, in milliseconds
158+
Population standard deviation of time spent planning the statement,
159+
in milliseconds
160+
(if <varname>pg_stat_statements.track_planning</varname> is enabled,
161+
otherwise zero)
149162
</para></entry>
150163
</row>
151164

@@ -594,7 +607,7 @@
594607
<para>
595608
<varname>pg_stat_statements.track_planning</varname> controls whether
596609
planning operations and duration are tracked by the module.
597-
The default value is <literal>on</literal>.
610+
The default value is <literal>off</literal>.
598611
Only superusers can change this setting.
599612
</para>
600613
</listitem>

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy