Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 87a2f05

Browse files
committed
Cause EXPLAIN's VERBOSE option to print the target list (output column list)
of each plan node, instead of its former behavior of dumping the internal representation of the plan tree. The latter display is still available for those who really want it (see debug_print_plan), but uses for it are certainly few and and far between. Per discussion. This patch also removes the explain_pretty_print GUC, which is obsoleted by the change.
1 parent 2f0f7b4 commit 87a2f05

File tree

6 files changed

+10
-62
lines changed

6 files changed

+10
-62
lines changed

doc/src/sgml/config.sgml

+1-15
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $PostgreSQL: pgsql/doc/src/sgml/config.sgml,v 1.174 2008/03/30 04:08:14 neilc Exp $ -->
1+
<!-- $PostgreSQL: pgsql/doc/src/sgml/config.sgml,v 1.175 2008/04/18 01:42:17 tgl Exp $ -->
22

33
<chapter Id="runtime-config">
44
<title>Server Configuration</title>
@@ -4187,20 +4187,6 @@ SET XML OPTION { DOCUMENT | CONTENT };
41874187

41884188
<variablelist>
41894189

4190-
<varlistentry id="guc-explain-pretty-print" xreflabel="explain_pretty_print">
4191-
<term><varname>explain_pretty_print</varname> (<type>boolean</type>)</term>
4192-
<indexterm>
4193-
<primary><varname>explain_pretty_print</> configuration parameter</primary>
4194-
</indexterm>
4195-
<listitem>
4196-
<para>
4197-
Determines whether <command>EXPLAIN VERBOSE</> uses the
4198-
indented or non-indented format for displaying detailed
4199-
query-tree dumps. The default is <literal>on</>.
4200-
</para>
4201-
</listitem>
4202-
</varlistentry>
4203-
42044190
<varlistentry id="guc-dynamic-library-path" xreflabel="dynamic_library_path">
42054191
<term><varname>dynamic_library_path</varname> (<type>string</type>)</term>
42064192
<indexterm>

doc/src/sgml/ref/explain.sgml

+2-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$PostgreSQL: pgsql/doc/src/sgml/ref/explain.sgml,v 1.41 2007/11/28 15:42:31 petere Exp $
2+
$PostgreSQL: pgsql/doc/src/sgml/ref/explain.sgml,v 1.42 2008/04/18 01:42:17 tgl Exp $
33
PostgreSQL documentation
44
-->
55

@@ -106,12 +106,7 @@ ROLLBACK;
106106
<term><literal>VERBOSE</literal></term>
107107
<listitem>
108108
<para>
109-
Show the full internal representation of the plan tree, rather
110-
than just a summary. Usually this option is only useful for
111-
specialized debugging purposes. The
112-
<literal>VERBOSE</literal> output is either pretty-printed or
113-
not, depending on the setting of the <xref
114-
linkend="guc-explain-pretty-print"> configuration parameter.
109+
Include the output column list for each node in the plan tree.
115110
</para>
116111
</listitem>
117112
</varlistentry>

src/backend/commands/explain.c

+5-26
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.172 2008/04/17 18:30:18 tgl Exp $
10+
* $PostgreSQL: pgsql/src/backend/commands/explain.c,v 1.173 2008/04/18 01:42:17 tgl Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -20,7 +20,6 @@
2020
#include "commands/prepare.h"
2121
#include "commands/trigger.h"
2222
#include "executor/instrument.h"
23-
#include "nodes/print.h"
2423
#include "optimizer/clauses.h"
2524
#include "optimizer/planner.h"
2625
#include "optimizer/var.h"
@@ -44,7 +43,7 @@ explain_get_index_name_hook_type explain_get_index_name_hook = NULL;
4443
typedef struct ExplainState
4544
{
4645
/* options */
47-
bool printNodes; /* do nodeToString() too */
46+
bool printTList; /* print plan targetlists */
4847
bool printAnalyze; /* print actual times */
4948
/* other states */
5049
PlannedStmt *pstmt; /* top of plan */
@@ -271,30 +270,11 @@ ExplainOnePlan(PlannedStmt *plannedstmt, ParamListInfo params,
271270

272271
es = (ExplainState *) palloc0(sizeof(ExplainState));
273272

274-
es->printNodes = stmt->verbose;
273+
es->printTList = stmt->verbose;
275274
es->printAnalyze = stmt->analyze;
276275
es->pstmt = queryDesc->plannedstmt;
277276
es->rtable = queryDesc->plannedstmt->rtable;
278277

279-
if (es->printNodes)
280-
{
281-
char *s;
282-
char *f;
283-
284-
s = nodeToString(queryDesc->plannedstmt->planTree);
285-
if (s)
286-
{
287-
if (Explain_pretty_print)
288-
f = pretty_format_node_dump(s);
289-
else
290-
f = format_node_dump(s);
291-
pfree(s);
292-
do_text_output_multiline(tstate, f);
293-
pfree(f);
294-
do_text_output_oneline(tstate, ""); /* separator line */
295-
}
296-
}
297-
298278
initStringInfo(&buf);
299279
explain_outNode(&buf,
300280
queryDesc->plannedstmt->planTree, queryDesc->planstate,
@@ -747,7 +727,8 @@ explain_outNode(StringInfo str,
747727
appendStringInfoChar(str, '\n');
748728

749729
/* target list */
750-
show_plan_tlist(plan, str, indent, es);
730+
if (es->printTList)
731+
show_plan_tlist(plan, str, indent, es);
751732

752733
/* quals, sort keys, etc */
753734
switch (nodeTag(plan))
@@ -1055,7 +1036,6 @@ static void
10551036
show_plan_tlist(Plan *plan,
10561037
StringInfo str, int indent, ExplainState *es)
10571038
{
1058-
#ifdef EXPLAIN_PRINT_TLISTS
10591039
List *context;
10601040
bool useprefix;
10611041
ListCell *lc;
@@ -1095,7 +1075,6 @@ show_plan_tlist(Plan *plan,
10951075
}
10961076

10971077
appendStringInfoChar(str, '\n');
1098-
#endif /* EXPLAIN_PRINT_TLISTS */
10991078
}
11001079

11011080
/*

src/backend/utils/misc/guc.c

+1-11
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* Written by Peter Eisentraut <peter_e@gmx.net>.
1111
*
1212
* IDENTIFICATION
13-
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.446 2008/04/04 17:25:23 tgl Exp $
13+
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.447 2008/04/18 01:42:17 tgl Exp $
1414
*
1515
*--------------------------------------------------------------------
1616
*/
@@ -282,7 +282,6 @@ bool Debug_print_plan = false;
282282
bool Debug_print_parse = false;
283283
bool Debug_print_rewritten = false;
284284
bool Debug_pretty_print = false;
285-
bool Explain_pretty_print = true;
286285

287286
bool log_parser_stats = false;
288287
bool log_planner_stats = false;
@@ -807,15 +806,6 @@ static struct config_bool ConfigureNamesBool[] =
807806
},
808807
#endif
809808

810-
{
811-
{"explain_pretty_print", PGC_USERSET, CLIENT_CONN_OTHER,
812-
gettext_noop("Uses the indented output format for EXPLAIN VERBOSE."),
813-
NULL
814-
},
815-
&Explain_pretty_print,
816-
true, NULL, NULL
817-
},
818-
819809
{
820810
{"track_activities", PGC_SUSET, STATS_COLLECTOR,
821811
gettext_noop("Collects information about executing commands."),

src/backend/utils/misc/postgresql.conf.sample

-1
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,6 @@
447447

448448
# - Other Defaults -
449449

450-
#explain_pretty_print = on
451450
#dynamic_library_path = '$libdir'
452451
#local_preload_libraries = ''
453452

src/include/utils/guc.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Copyright (c) 2000-2008, PostgreSQL Global Development Group
88
* Written by Peter Eisentraut <peter_e@gmx.net>.
99
*
10-
* $PostgreSQL: pgsql/src/include/utils/guc.h,v 1.93 2008/04/02 14:42:56 mha Exp $
10+
* $PostgreSQL: pgsql/src/include/utils/guc.h,v 1.94 2008/04/18 01:42:17 tgl Exp $
1111
*--------------------------------------------------------------------
1212
*/
1313
#ifndef GUC_H
@@ -127,7 +127,6 @@ extern bool Debug_print_plan;
127127
extern bool Debug_print_parse;
128128
extern bool Debug_print_rewritten;
129129
extern bool Debug_pretty_print;
130-
extern bool Explain_pretty_print;
131130

132131
extern bool log_parser_stats;
133132
extern bool log_planner_stats;

0 commit comments

Comments
 (0)