Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5788cca

Browse files
author
Neil Conway
committed
Remove unused 'printCost' field from ExplainState, and simplify the code
accordingly (this field was always initialized to true). Patch fromAlvaro Herrera.
1 parentba42002 commit5788cca

File tree

1 file changed

+28
-39
lines changed

1 file changed

+28
-39
lines changed

‎src/backend/commands/explain.c

Lines changed: 28 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1994-5, Regents of the University of California
88
*
99
* 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 $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -38,7 +38,6 @@
3838
typedefstructExplainState
3939
{
4040
/* options */
41-
boolprintCost;/* print cost */
4241
boolprintNodes;/* do nodeToString() too */
4342
boolprintAnalyze;/* print actual times */
4443
/* other states */
@@ -246,7 +245,6 @@ ExplainOnePlan(QueryDesc *queryDesc, ExplainStmt *stmt,
246245

247246
es= (ExplainState*)palloc0(sizeof(ExplainState));
248247

249-
es->printCost= true;/* default */
250248
es->printNodes=stmt->verbose;
251249
es->printAnalyze=stmt->analyze;
252250
es->rtable=queryDesc->parsetree->rtable;
@@ -266,18 +264,14 @@ ExplainOnePlan(QueryDesc *queryDesc, ExplainStmt *stmt,
266264
pfree(s);
267265
do_text_output_multiline(tstate,f);
268266
pfree(f);
269-
if (es->printCost)
270-
do_text_output_oneline(tstate,"");/* separator line */
267+
do_text_output_oneline(tstate,"");/* separator line */
271268
}
272269
}
273270

274271
str=makeStringInfo();
275272

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);
281275

282276
/*
283277
* If we ran the command, run any AFTER triggers it queued. (Note this
@@ -358,13 +352,10 @@ ExplainOnePlan(QueryDesc *queryDesc, ExplainStmt *stmt,
358352

359353
totaltime+=elapsed_time(&starttime);
360354

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);
368359

369360
pfree(str->data);
370361
pfree(str);
@@ -667,32 +658,30 @@ explain_outNode(StringInfo str,
667658
default:
668659
break;
669660
}
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);
675665

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);
682672

683-
if (planstate->instrument&&planstate->instrument->nloops>0)
684-
{
685-
doublenloops=planstate->instrument->nloops;
673+
if (planstate->instrument&&planstate->instrument->nloops>0)
674+
{
675+
doublenloops=planstate->instrument->nloops;
686676

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-
elseif (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);
695682
}
683+
elseif (es->printAnalyze)
684+
appendStringInfo(str," (never executed)");
696685
appendStringInfoChar(str,'\n');
697686

698687
/* quals, sort keys, etc */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp