aboutsummaryrefslogtreecommitdiff
path: root/contrib/auto_explain/auto_explain.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2014-09-19 13:19:02 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2014-09-19 13:19:02 -0400
commit9474c9d8107ba21ed9b8b9c1efde433f3d20e45f (patch)
treedc385a3a981768e75269b1d3cb4b469b408710b9 /contrib/auto_explain/auto_explain.c
parent855cabb6f59c06f3ffcddade59bfbee60dab61aa (diff)
downloadpostgresql-9474c9d8107ba21ed9b8b9c1efde433f3d20e45f.tar.gz
postgresql-9474c9d8107ba21ed9b8b9c1efde433f3d20e45f.zip
Fix failure of contrib/auto_explain to print per-node timing information.
This has been broken since commit af7914c6627bcf0b0ca614e9ce95d3f8056602bf, which added the EXPLAIN (TIMING) option. Although that commit included updates to auto_explain, they evidently weren't tested very carefully, because the code failed to print node timings even when it should, due to failure to set es.timing in the ExplainState struct. Reported off-list by Neelakanth Nadgir of Salesforce. In passing, clean up the documentation for auto_explain's options a little bit, including re-ordering them into what seems to me a more logical order.
Diffstat (limited to 'contrib/auto_explain/auto_explain.c')
-rw-r--r--contrib/auto_explain/auto_explain.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/contrib/auto_explain/auto_explain.c b/contrib/auto_explain/auto_explain.c
index 57dfbe2887a..1d97c82de6a 100644
--- a/contrib/auto_explain/auto_explain.c
+++ b/contrib/auto_explain/auto_explain.c
@@ -25,7 +25,7 @@ static int auto_explain_log_min_duration = -1; /* msec or -1 */
static bool auto_explain_log_analyze = false;
static bool auto_explain_log_verbose = false;
static bool auto_explain_log_buffers = false;
-static bool auto_explain_log_timing = false;
+static bool auto_explain_log_timing = true;
static int auto_explain_log_format = EXPLAIN_FORMAT_TEXT;
static bool auto_explain_log_nested_statements = false;
@@ -188,8 +188,6 @@ explain_ExecutorStart(QueryDesc *queryDesc, int eflags)
queryDesc->instrument_options |= INSTRUMENT_TIMER;
else
queryDesc->instrument_options |= INSTRUMENT_ROWS;
-
-
if (auto_explain_log_buffers)
queryDesc->instrument_options |= INSTRUMENT_BUFFERS;
}
@@ -290,6 +288,7 @@ explain_ExecutorEnd(QueryDesc *queryDesc)
es.analyze = (queryDesc->instrument_options && auto_explain_log_analyze);
es.verbose = auto_explain_log_verbose;
es.buffers = (es.analyze && auto_explain_log_buffers);
+ es.timing = (es.analyze && auto_explain_log_timing);
es.format = auto_explain_log_format;
ExplainBeginOutput(&es);