]> granicus.if.org Git - postgresql/commitdiff
Cause EXPLAIN's VERBOSE option to print the target list (output column list)
authorTom Lane <tgl@sss.pgh.pa.us>
Fri, 18 Apr 2008 01:42:17 +0000 (01:42 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Fri, 18 Apr 2008 01:42:17 +0000 (01:42 +0000)
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.

doc/src/sgml/config.sgml
doc/src/sgml/ref/explain.sgml
src/backend/commands/explain.c
src/backend/utils/misc/guc.c
src/backend/utils/misc/postgresql.conf.sample
src/include/utils/guc.h

index fa8ce23a46cfb7fb7bd0265539394e8fd82eec6a..8658f493d5b27389cee5ddc1438485324e0495be 100644 (file)
@@ -1,4 +1,4 @@
-<!-- $PostgreSQL: pgsql/doc/src/sgml/config.sgml,v 1.174 2008/03/30 04:08:14 neilc Exp $ -->
+<!-- $PostgreSQL: pgsql/doc/src/sgml/config.sgml,v 1.175 2008/04/18 01:42:17 tgl Exp $ -->
 
 <chapter Id="runtime-config">
   <title>Server Configuration</title>
@@ -4187,20 +4187,6 @@ SET XML OPTION { DOCUMENT | CONTENT };
 
      <variablelist>
 
-     <varlistentry id="guc-explain-pretty-print" xreflabel="explain_pretty_print">
-      <term><varname>explain_pretty_print</varname> (<type>boolean</type>)</term>
-      <indexterm>
-       <primary><varname>explain_pretty_print</> configuration parameter</primary>
-      </indexterm>
-      <listitem>
-       <para>
-        Determines whether <command>EXPLAIN VERBOSE</> uses the
-        indented or non-indented format for displaying detailed
-        query-tree dumps. The default is <literal>on</>.
-       </para>
-      </listitem>
-     </varlistentry>
-
      <varlistentry id="guc-dynamic-library-path" xreflabel="dynamic_library_path">
       <term><varname>dynamic_library_path</varname> (<type>string</type>)</term>
       <indexterm>
index 89fb0274cac2018a97b8f674d21e88e3c14b193f..73cea6b00fa69293fa0086f0bae69a7729ffcfa3 100644 (file)
@@ -1,5 +1,5 @@
 <!--
-$PostgreSQL: pgsql/doc/src/sgml/ref/explain.sgml,v 1.41 2007/11/28 15:42:31 petere Exp $
+$PostgreSQL: pgsql/doc/src/sgml/ref/explain.sgml,v 1.42 2008/04/18 01:42:17 tgl Exp $
 PostgreSQL documentation
 -->
 
@@ -106,12 +106,7 @@ ROLLBACK;
     <term><literal>VERBOSE</literal></term>
     <listitem>
      <para>
-      Show the full internal representation of the plan tree, rather
-      than just a summary.  Usually this option is only useful for
-      specialized debugging purposes.  The
-      <literal>VERBOSE</literal> output is either pretty-printed or
-      not, depending on the setting of the <xref
-      linkend="guc-explain-pretty-print"> configuration parameter.
+      Include the output column list for each node in the plan tree.
      </para>
     </listitem>
    </varlistentry>
index 768ae7797ef80a6e1393b29f3de3d053ad64a9b8..cbcc2a67e1cbe1853626678098dc0d2ea2f29574 100644 (file)
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1994-5, Regents of the University of California
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/commands/explain.c,v 1.172 2008/04/17 18:30:18 tgl Exp $
+ *       $PostgreSQL: pgsql/src/backend/commands/explain.c,v 1.173 2008/04/18 01:42:17 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -20,7 +20,6 @@
 #include "commands/prepare.h"
 #include "commands/trigger.h"
 #include "executor/instrument.h"
-#include "nodes/print.h"
 #include "optimizer/clauses.h"
 #include "optimizer/planner.h"
 #include "optimizer/var.h"
@@ -44,7 +43,7 @@ explain_get_index_name_hook_type explain_get_index_name_hook = NULL;
 typedef struct ExplainState
 {
        /* options */
-       bool            printNodes;             /* do nodeToString() too */
+       bool            printTList;             /* print plan targetlists */
        bool            printAnalyze;   /* print actual times */
        /* other states */
        PlannedStmt *pstmt;                     /* top of plan */
@@ -271,30 +270,11 @@ ExplainOnePlan(PlannedStmt *plannedstmt, ParamListInfo params,
 
        es = (ExplainState *) palloc0(sizeof(ExplainState));
 
-       es->printNodes = stmt->verbose;
+       es->printTList = stmt->verbose;
        es->printAnalyze = stmt->analyze;
        es->pstmt = queryDesc->plannedstmt;
        es->rtable = queryDesc->plannedstmt->rtable;
 
-       if (es->printNodes)
-       {
-               char       *s;
-               char       *f;
-
-               s = nodeToString(queryDesc->plannedstmt->planTree);
-               if (s)
-               {
-                       if (Explain_pretty_print)
-                               f = pretty_format_node_dump(s);
-                       else
-                               f = format_node_dump(s);
-                       pfree(s);
-                       do_text_output_multiline(tstate, f);
-                       pfree(f);
-                       do_text_output_oneline(tstate, ""); /* separator line */
-               }
-       }
-
        initStringInfo(&buf);
        explain_outNode(&buf,
                                        queryDesc->plannedstmt->planTree, queryDesc->planstate,
@@ -747,7 +727,8 @@ explain_outNode(StringInfo str,
        appendStringInfoChar(str, '\n');
 
        /* target list */
-       show_plan_tlist(plan, str, indent, es);
+       if (es->printTList)
+               show_plan_tlist(plan, str, indent, es);
 
        /* quals, sort keys, etc */
        switch (nodeTag(plan))
@@ -1055,7 +1036,6 @@ static void
 show_plan_tlist(Plan *plan,
                                StringInfo str, int indent, ExplainState *es)
 {
-#ifdef EXPLAIN_PRINT_TLISTS
        List       *context;
        bool            useprefix;
        ListCell   *lc;
@@ -1095,7 +1075,6 @@ show_plan_tlist(Plan *plan,
        }
 
        appendStringInfoChar(str, '\n');
-#endif /* EXPLAIN_PRINT_TLISTS */
 }
 
 /*
index 15e5d54e415cb52685e41455ee187ce61e63c43d..a2faea97825be7010fd643023a97323e259044f6 100644 (file)
@@ -10,7 +10,7 @@
  * Written by Peter Eisentraut <peter_e@gmx.net>.
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.446 2008/04/04 17:25:23 tgl Exp $
+ *       $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.447 2008/04/18 01:42:17 tgl Exp $
  *
  *--------------------------------------------------------------------
  */
@@ -282,7 +282,6 @@ bool                Debug_print_plan = false;
 bool           Debug_print_parse = false;
 bool           Debug_print_rewritten = false;
 bool           Debug_pretty_print = false;
-bool           Explain_pretty_print = true;
 
 bool           log_parser_stats = false;
 bool           log_planner_stats = false;
@@ -807,15 +806,6 @@ static struct config_bool ConfigureNamesBool[] =
        },
 #endif
 
-       {
-               {"explain_pretty_print", PGC_USERSET, CLIENT_CONN_OTHER,
-                       gettext_noop("Uses the indented output format for EXPLAIN VERBOSE."),
-                       NULL
-               },
-               &Explain_pretty_print,
-               true, NULL, NULL
-       },
-
        {
                {"track_activities", PGC_SUSET, STATS_COLLECTOR,
                        gettext_noop("Collects information about executing commands."),
index e5ae0e851885ff6c5f83ee947751fe9ebae08777..9fb567bd62b08d1efa544c005e819001f04d1d84 100644 (file)
 
 # - Other Defaults -
 
-#explain_pretty_print = on
 #dynamic_library_path = '$libdir'
 #local_preload_libraries = ''
 
index b0fb369f85114ee308ba50b866363591762d8aca..b6103550ad0bc2d62ef7b228c2dfd4ada2335ac5 100644 (file)
@@ -7,7 +7,7 @@
  * Copyright (c) 2000-2008, PostgreSQL Global Development Group
  * Written by Peter Eisentraut <peter_e@gmx.net>.
  *
- * $PostgreSQL: pgsql/src/include/utils/guc.h,v 1.93 2008/04/02 14:42:56 mha Exp $
+ * $PostgreSQL: pgsql/src/include/utils/guc.h,v 1.94 2008/04/18 01:42:17 tgl Exp $
  *--------------------------------------------------------------------
  */
 #ifndef GUC_H
@@ -127,7 +127,6 @@ extern bool Debug_print_plan;
 extern bool Debug_print_parse;
 extern bool Debug_print_rewritten;
 extern bool Debug_pretty_print;
-extern bool Explain_pretty_print;
 
 extern bool log_parser_stats;
 extern bool log_planner_stats;