Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite2a0fc5

Browse files
committed
auto_explain: Add logging of trigger execution
Author: Kyotaro HORIGUCHIReviewed-by: Jaime Casanova
1 parent84df54b commite2a0fc5

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

‎contrib/auto_explain/auto_explain.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ static intauto_explain_log_min_duration = -1; /* msec or -1 */
2525
staticboolauto_explain_log_analyze= false;
2626
staticboolauto_explain_log_verbose= false;
2727
staticboolauto_explain_log_buffers= false;
28+
staticboolauto_explain_log_triggers= false;
2829
staticboolauto_explain_log_timing= false;
2930
staticintauto_explain_log_format=EXPLAIN_FORMAT_TEXT;
3031
staticboolauto_explain_log_nested_statements= false;
@@ -113,6 +114,17 @@ _PG_init(void)
113114
NULL,
114115
NULL);
115116

117+
DefineCustomBoolVariable("auto_explain.log_triggers",
118+
"Include trigger statistics in plans.",
119+
"This has no effect unless log_analyze is also set.",
120+
&auto_explain_log_triggers,
121+
false,
122+
PGC_SUSET,
123+
0,
124+
NULL,
125+
NULL,
126+
NULL);
127+
116128
DefineCustomEnumVariable("auto_explain.log_format",
117129
"EXPLAIN format to be used for plan logging.",
118130
NULL,
@@ -295,6 +307,8 @@ explain_ExecutorEnd(QueryDesc *queryDesc)
295307
ExplainBeginOutput(&es);
296308
ExplainQueryText(&es,queryDesc);
297309
ExplainPrintPlan(&es,queryDesc);
310+
if (es.analyze&&auto_explain_log_triggers)
311+
ExplainPrintTriggers(&es,queryDesc);
298312
ExplainEndOutput(&es);
299313

300314
/* Remove last line break */

‎doc/src/sgml/auto-explain.sgml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,24 @@ LOAD 'auto_explain';
122122
</listitem>
123123
</varlistentry>
124124

125+
<varlistentry>
126+
<term>
127+
<varname>auto_explain.log_triggers</varname> (<type>boolean</type>)
128+
</term>
129+
<indexterm>
130+
<primary><varname>auto_explain.log_triggers</> configuration parameter</primary>
131+
</indexterm>
132+
<listitem>
133+
<para>
134+
<varname>auto_explain.log_triggers</varname> causes trigger
135+
execution statistics to be included when an execution plan is logged.
136+
This parameter is off by default. Only superusers can change this
137+
setting. This parameter has no effect unless
138+
<varname>auto_explain.log_analyze</> parameter is set.
139+
</para>
140+
</listitem>
141+
</varlistentry>
142+
125143
<varlistentry>
126144
<term>
127145
<varname>auto_explain.log_format</varname> (<type>enum</type>)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp