7
7
* Portions Copyright (c) 1994-5, Regents of the University of California
8
8
*
9
9
* IDENTIFICATION
10
- * $PostgreSQL: pgsql/src/backend/commands/explain.c,v 1.136 2005/06/03 23:05:28 tgl Exp $
10
+ * $PostgreSQL: pgsql/src/backend/commands/explain.c,v 1.137 2005/06/04 02:07:09 neilc Exp $
11
11
*
12
12
*-------------------------------------------------------------------------
13
13
*/
38
38
typedef struct ExplainState
39
39
{
40
40
/* options */
41
- bool printCost ; /* print cost */
42
41
bool printNodes ; /* do nodeToString() too */
43
42
bool printAnalyze ; /* print actual times */
44
43
/* other states */
@@ -246,7 +245,6 @@ ExplainOnePlan(QueryDesc *queryDesc, ExplainStmt *stmt,
246
245
247
246
es = (ExplainState * ) palloc0 (sizeof (ExplainState ));
248
247
249
- es -> printCost = true; /* default */
250
248
es -> printNodes = stmt -> verbose ;
251
249
es -> printAnalyze = stmt -> analyze ;
252
250
es -> rtable = queryDesc -> parsetree -> rtable ;
@@ -266,18 +264,14 @@ ExplainOnePlan(QueryDesc *queryDesc, ExplainStmt *stmt,
266
264
pfree (s );
267
265
do_text_output_multiline (tstate , f );
268
266
pfree (f );
269
- if (es -> printCost )
270
- do_text_output_oneline (tstate , "" ); /* separator line */
267
+ do_text_output_oneline (tstate , "" ); /* separator line */
271
268
}
272
269
}
273
270
274
271
str = makeStringInfo ();
275
272
276
- if (es -> printCost )
277
- {
278
- explain_outNode (str , queryDesc -> plantree , queryDesc -> planstate ,
279
- NULL , 0 , es );
280
- }
273
+ explain_outNode (str , queryDesc -> plantree , queryDesc -> planstate ,
274
+ NULL , 0 , es );
281
275
282
276
/*
283
277
* If we ran the command, run any AFTER triggers it queued. (Note this
@@ -358,13 +352,10 @@ ExplainOnePlan(QueryDesc *queryDesc, ExplainStmt *stmt,
358
352
359
353
totaltime += elapsed_time (& starttime );
360
354
361
- if (es -> printCost )
362
- {
363
- if (stmt -> analyze )
364
- appendStringInfo (str , "Total runtime: %.3f ms\n" ,
365
- 1000.0 * totaltime );
366
- do_text_output_multiline (tstate , str -> data );
367
- }
355
+ if (stmt -> analyze )
356
+ appendStringInfo (str , "Total runtime: %.3f ms\n" ,
357
+ 1000.0 * totaltime );
358
+ do_text_output_multiline (tstate , str -> data );
368
359
369
360
pfree (str -> data );
370
361
pfree (str );
@@ -667,32 +658,30 @@ explain_outNode(StringInfo str,
667
658
default :
668
659
break ;
669
660
}
670
- if (es -> printCost )
671
- {
672
- appendStringInfo (str , " (cost=%.2f..%.2f rows=%.0f width=%d)" ,
673
- plan -> startup_cost , plan -> total_cost ,
674
- plan -> plan_rows , plan -> plan_width );
661
+
662
+ appendStringInfo (str , " (cost=%.2f..%.2f rows=%.0f width=%d)" ,
663
+ plan -> startup_cost , plan -> total_cost ,
664
+ plan -> plan_rows , plan -> plan_width );
675
665
676
- /*
677
- * We have to forcibly clean up the instrumentation state because
678
- * we haven't done ExecutorEnd yet. This is pretty grotty ...
679
- */
680
- if (planstate -> instrument )
681
- InstrEndLoop (planstate -> instrument );
666
+ /*
667
+ * We have to forcibly clean up the instrumentation state because
668
+ * we haven't done ExecutorEnd yet. This is pretty grotty ...
669
+ */
670
+ if (planstate -> instrument )
671
+ InstrEndLoop (planstate -> instrument );
682
672
683
- if (planstate -> instrument && planstate -> instrument -> nloops > 0 )
684
- {
685
- double nloops = planstate -> instrument -> nloops ;
673
+ if (planstate -> instrument && planstate -> instrument -> nloops > 0 )
674
+ {
675
+ double nloops = planstate -> instrument -> nloops ;
686
676
687
- appendStringInfo (str , " (actual time=%.3f..%.3f rows=%.0f loops=%.0f)" ,
688
- 1000.0 * planstate -> instrument -> startup / nloops ,
689
- 1000.0 * planstate -> instrument -> total / nloops ,
690
- planstate -> instrument -> ntuples / nloops ,
691
- planstate -> instrument -> nloops );
692
- }
693
- else if (es -> printAnalyze )
694
- appendStringInfo (str , " (never executed)" );
677
+ appendStringInfo (str , " (actual time=%.3f..%.3f rows=%.0f loops=%.0f)" ,
678
+ 1000.0 * planstate -> instrument -> startup / nloops ,
679
+ 1000.0 * planstate -> instrument -> total / nloops ,
680
+ planstate -> instrument -> ntuples / nloops ,
681
+ planstate -> instrument -> nloops );
695
682
}
683
+ else if (es -> printAnalyze )
684
+ appendStringInfo (str , " (never executed)" );
696
685
appendStringInfoChar (str , '\n' );
697
686
698
687
/* quals, sort keys, etc */
0 commit comments