@@ -25,6 +25,7 @@ static int auto_explain_log_min_duration = -1; /* msec or -1 */
25
25
static bool auto_explain_log_analyze = false;
26
26
static bool auto_explain_log_verbose = false;
27
27
static bool auto_explain_log_buffers = false;
28
+ static bool auto_explain_log_triggers = false;
28
29
static bool auto_explain_log_timing = false;
29
30
static int auto_explain_log_format = EXPLAIN_FORMAT_TEXT ;
30
31
static bool auto_explain_log_nested_statements = false;
@@ -113,6 +114,17 @@ _PG_init(void)
113
114
NULL ,
114
115
NULL );
115
116
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
+
116
128
DefineCustomEnumVariable ("auto_explain.log_format" ,
117
129
"EXPLAIN format to be used for plan logging." ,
118
130
NULL ,
@@ -295,6 +307,8 @@ explain_ExecutorEnd(QueryDesc *queryDesc)
295
307
ExplainBeginOutput (& es );
296
308
ExplainQueryText (& es , queryDesc );
297
309
ExplainPrintPlan (& es , queryDesc );
310
+ if (es .analyze && auto_explain_log_triggers )
311
+ ExplainPrintTriggers (& es , queryDesc );
298
312
ExplainEndOutput (& es );
299
313
300
314
/* Remove last line break */
0 commit comments