Skip to content
Snippets Groups Projects
Commit ac376a3e authored by Bruce Momjian's avatar Bruce Momjian
Browse files

As Niel so nicely pointed out this morning, the output of EXPLAIN

ANALYZE is not quite clear when branches of the query are never
executed. So this tiny patch fixes that.

The patch is attached and can also be found at:
http://svana.org/kleptog/pgsql/pgsql-explain.patch

Martijn van Oosterhout
parent 1f653ec3
No related branches found
No related tags found
No related merge requests found
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994-5, Regents of the University of California * Portions Copyright (c) 1994-5, Regents of the University of California
* *
* $Header: /cvsroot/pgsql/src/backend/commands/explain.c,v 1.88 2002/09/19 22:48:33 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/commands/explain.c,v 1.89 2002/10/14 04:26:54 momjian Exp $
* *
*/ */
...@@ -35,6 +35,7 @@ typedef struct ExplainState ...@@ -35,6 +35,7 @@ typedef struct ExplainState
/* options */ /* options */
bool printCost; /* print cost */ bool printCost; /* print cost */
bool printNodes; /* do nodeToString() instead */ bool printNodes; /* do nodeToString() instead */
bool printAnalyze; /* print actual times */
/* other states */ /* other states */
List *rtable; /* range table */ List *rtable; /* range table */
} ExplainState; } ExplainState;
...@@ -405,6 +406,11 @@ explain_outNode(StringInfo str, Plan *plan, Plan *outer_plan, ...@@ -405,6 +406,11 @@ explain_outNode(StringInfo str, Plan *plan, Plan *outer_plan,
1000.0 * plan->instrument->total / nloops, 1000.0 * plan->instrument->total / nloops,
plan->instrument->ntuples / nloops, plan->instrument->ntuples / nloops,
plan->instrument->nloops); plan->instrument->nloops);
es->printAnalyze = true;
}
else if( es->printAnalyze )
{
appendStringInfo(str, " (never executed)");
} }
} }
appendStringInfo(str, "\n"); appendStringInfo(str, "\n");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment