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:18:56 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2014-09-19 13:19:27 -0400
commit898f8a96ef9dfa79eac9ec1621a89e71fe16601c (patch)
tree26bae6dbc77be2c66556e6de1f1c683d26ea7aba /contrib/auto_explain/auto_explain.c
parenta92b5f969bed9796bcb3c321e7be4124a4533067 (diff)
downloadpostgresql-898f8a96ef9dfa79eac9ec1621a89e71fe16601c.tar.gz
postgresql-898f8a96ef9dfa79eac9ec1621a89e71fe16601c.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 cbbd25753f7..b33b2211ca0 100644
--- a/contrib/auto_explain/auto_explain.c
+++ b/contrib/auto_explain/auto_explain.c
@@ -26,7 +26,7 @@ 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_triggers = 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;
@@ -200,8 +200,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;
}
@@ -302,6 +300,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);