From 898f8a96ef9dfa79eac9ec1621a89e71fe16601c Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Fri, 19 Sep 2014 13:18:56 -0400 Subject: 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. --- contrib/auto_explain/auto_explain.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'contrib/auto_explain/auto_explain.c') 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); -- cgit v1.2.3