aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/backend/commands/explain.c10
-rw-r--r--src/include/commands/explain.h5
2 files changed, 10 insertions, 5 deletions
diff --git a/src/backend/commands/explain.c b/src/backend/commands/explain.c
index 387d263e873..3fcc1ddc69c 100644
--- a/src/backend/commands/explain.c
+++ b/src/backend/commands/explain.c
@@ -191,6 +191,9 @@ ExplainQuery(ExplainStmt *stmt, const char *queryString,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("EXPLAIN option TIMING requires ANALYZE")));
+ /* currently, summary option is not exposed to users; just set it */
+ es.summary = es.analyze;
+
/*
* Parse analysis was done already, but we still have to run the rule
* rewriter. We do not do AcquireRewriteLocks: we assume the query either
@@ -431,7 +434,8 @@ ExplainOnePlan(PlannedStmt *plannedstmt, IntoClause *into, ExplainState *es,
/*
* We always collect timing for the entire statement, even when node-level
- * timing is off, so we don't look at es->timing here.
+ * timing is off, so we don't look at es->timing here. (We could skip
+ * this if !es->summary, but it's hardly worth the complication.)
*/
INSTR_TIME_SET_CURRENT(starttime);
@@ -493,7 +497,7 @@ ExplainOnePlan(PlannedStmt *plannedstmt, IntoClause *into, ExplainState *es,
/* Create textual dump of plan tree */
ExplainPrintPlan(es, queryDesc);
- if (es->costs && planduration)
+ if (es->summary && planduration)
{
double plantime = INSTR_TIME_GET_DOUBLE(*planduration);
@@ -526,7 +530,7 @@ ExplainOnePlan(PlannedStmt *plannedstmt, IntoClause *into, ExplainState *es,
totaltime += elapsed_time(&starttime);
- if (es->analyze)
+ if (es->summary)
{
if (es->format == EXPLAIN_FORMAT_TEXT)
appendStringInfo(es->str, "Execution time: %.3f ms\n",
diff --git a/src/include/commands/explain.h b/src/include/commands/explain.h
index 3488be39c38..d56beaac159 100644
--- a/src/include/commands/explain.h
+++ b/src/include/commands/explain.h
@@ -30,9 +30,10 @@ typedef struct ExplainState
/* options */
bool verbose; /* be verbose */
bool analyze; /* print actual times */
- bool costs; /* print costs */
+ bool costs; /* print estimated costs */
bool buffers; /* print buffer usage */
- bool timing; /* print timing */
+ bool timing; /* print detailed node timing */
+ bool summary; /* print total planning and execution timing */
ExplainFormat format; /* output format */
/* other states */
PlannedStmt *pstmt; /* top of plan */