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

Commit9650830

Browse files
committed
Cause the output from debug_print_parse, debug_print_rewritten, and
debug_print_plan to appear at LOG message level, not DEBUG1 as historically.Make debug_pretty_print default to on. Also, cause plans generated viaEXPLAIN to be subject to debug_print_plan. This is all to makedebug_print_plan a reasonably comfortable substitute for the former behaviorof EXPLAIN VERBOSE.
1 parent2aaca8e commit9650830

File tree

5 files changed

+40
-28
lines changed

5 files changed

+40
-28
lines changed

‎doc/src/sgml/config.sgml

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $PostgreSQL: pgsql/doc/src/sgml/config.sgml,v 1.185 2008/08/15 08:37:41 mha Exp $ -->
1+
<!-- $PostgreSQL: pgsql/doc/src/sgml/config.sgml,v 1.186 2008/08/19 18:30:04 tgl Exp $ -->
22

33
<chapter Id="runtime-config">
44
<title>Server Configuration</title>
@@ -2817,7 +2817,6 @@ local0.* /var/log/postgresql
28172817
<term><varname>debug_print_parse</varname> (<type>boolean</type>)</term>
28182818
<term><varname>debug_print_rewritten</varname> (<type>boolean</type>)</term>
28192819
<term><varname>debug_print_plan</varname> (<type>boolean</type>)</term>
2820-
<term><varname>debug_pretty_print</varname> (<type>boolean</type>)</term>
28212820
<indexterm>
28222821
<primary><varname>debug_print_parse</> configuration parameter</primary>
28232822
</indexterm>
@@ -2827,21 +2826,34 @@ local0.* /var/log/postgresql
28272826
<indexterm>
28282827
<primary><varname>debug_print_plan</> configuration parameter</primary>
28292828
</indexterm>
2829+
<listitem>
2830+
<para>
2831+
These parameters enable various debugging output to be emitted.
2832+
When set, they print the resulting parse tree, the query rewriter
2833+
output, or the execution plan for each executed query.
2834+
These messages are emitted at <literal>LOG</> message level, so by
2835+
default they will appear in the server log but will not be sent to the
2836+
client. You can change that by adjusting
2837+
<xref linkend="guc-client-min-messages"> and/or
2838+
<xref linkend="guc-log-min-messages">.
2839+
These parameters are off by default.
2840+
</para>
2841+
</listitem>
2842+
</varlistentry>
2843+
2844+
<varlistentry>
2845+
<term><varname>debug_pretty_print</varname> (<type>boolean</type>)</term>
28302846
<indexterm>
28312847
<primary><varname>debug_pretty_print</> configuration parameter</primary>
28322848
</indexterm>
28332849
<listitem>
28342850
<para>
2835-
These parameters enable various debugging output to be emitted.
2836-
For each executed query, they print
2837-
the resulting parse tree, the query rewriter output, or the
2838-
execution plan. <varname>debug_pretty_print</varname> indents
2839-
these displays to produce a more readable but much longer
2840-
output format. <varname>client_min_messages</varname> or
2841-
<varname>log_min_messages</varname> must be
2842-
<literal>DEBUG1</literal> or lower to actually send this output
2843-
to the client or the server log, respectively.
2844-
These parameters are off by default.
2851+
When set, <varname>debug_pretty_print</varname> indents the messages
2852+
produced by <varname>debug_print_parse</varname>,
2853+
<varname>debug_print_rewritten</varname>, or
2854+
<varname>debug_print_plan</varname>. This results in more readable
2855+
but much longer output than the <quote>compact</> format used when
2856+
it is off. It is on by default.
28452857
</para>
28462858
</listitem>
28472859
</varlistentry>

‎src/backend/commands/explain.c

Lines changed: 2 additions & 2 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.177 2008/08/14 18:47:58 tgl Exp $
10+
* $PostgreSQL: pgsql/src/backend/commands/explain.c,v 1.178 2008/08/19 18:30:04 tgl Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -169,7 +169,7 @@ ExplainOneQuery(Query *query, ExplainStmt *stmt, const char *queryString,
169169
PlannedStmt*plan;
170170

171171
/* plan the query */
172-
plan=planner(query,0,params);
172+
plan=pg_plan_query(query,0,params);
173173

174174
/* run it (if needed) and produce output */
175175
ExplainOnePlan(plan,params,stmt,tstate);

‎src/backend/tcop/postgres.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.555 2008/08/01 13:16:09 alvherre Exp $
11+
* $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.556 2008/08/19 18:30:04 tgl Exp $
1212
*
1313
* NOTES
1414
* this is the "main" module of the postgres backend and
@@ -630,13 +630,13 @@ pg_rewrite_query(Query *query)
630630
{
631631
List*querytree_list;
632632

633-
if (log_parser_stats)
634-
ResetUsage();
635-
636633
if (Debug_print_parse)
637-
elog_node_display(DEBUG1,"parse tree",query,
634+
elog_node_display(LOG,"parse tree",query,
638635
Debug_pretty_print);
639636

637+
if (log_parser_stats)
638+
ResetUsage();
639+
640640
if (query->commandType==CMD_UTILITY)
641641
{
642642
/* don't rewrite utilities, just dump 'em into result list */
@@ -666,7 +666,7 @@ pg_rewrite_query(Query *query)
666666
#endif
667667

668668
if (Debug_print_rewritten)
669-
elog_node_display(DEBUG1,"rewritten parse tree",querytree_list,
669+
elog_node_display(LOG,"rewritten parse tree",querytree_list,
670670
Debug_pretty_print);
671671

672672
returnquerytree_list;
@@ -720,7 +720,7 @@ pg_plan_query(Query *querytree, int cursorOptions, ParamListInfo boundParams)
720720
* Print plan if debugging.
721721
*/
722722
if (Debug_print_plan)
723-
elog_node_display(DEBUG1,"plan",plan,Debug_pretty_print);
723+
elog_node_display(LOG,"plan",plan,Debug_pretty_print);
724724

725725
TRACE_POSTGRESQL_QUERY_PLAN_DONE();
726726

‎src/backend/utils/misc/guc.c

Lines changed: 6 additions & 6 deletions
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.466 2008/08/15 08:37:40 mha Exp $
13+
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.467 2008/08/19 18:30:04 tgl Exp $
1414
*
1515
*--------------------------------------------------------------------
1616
*/
@@ -316,7 +316,7 @@ boollog_duration = false;
316316
boolDebug_print_plan= false;
317317
boolDebug_print_parse= false;
318318
boolDebug_print_rewritten= false;
319-
boolDebug_pretty_print=false;
319+
boolDebug_pretty_print=true;
320320

321321
boollog_parser_stats= false;
322322
boollog_planner_stats= false;
@@ -772,23 +772,23 @@ static struct config_bool ConfigureNamesBool[] =
772772
},
773773
{
774774
{"debug_print_parse",PGC_USERSET,LOGGING_WHAT,
775-
gettext_noop("Prints theparse tree to the server log."),
775+
gettext_noop("Logs each query'sparse tree."),
776776
NULL
777777
},
778778
&Debug_print_parse,
779779
false,NULL,NULL
780780
},
781781
{
782782
{"debug_print_rewritten",PGC_USERSET,LOGGING_WHAT,
783-
gettext_noop("Prints the parse tree after rewriting to server log."),
783+
gettext_noop("Logs each query's rewritten parse tree."),
784784
NULL
785785
},
786786
&Debug_print_rewritten,
787787
false,NULL,NULL
788788
},
789789
{
790790
{"debug_print_plan",PGC_USERSET,LOGGING_WHAT,
791-
gettext_noop("Prints theexecution plan to server log."),
791+
gettext_noop("Logs each query'sexecution plan."),
792792
NULL
793793
},
794794
&Debug_print_plan,
@@ -800,7 +800,7 @@ static struct config_bool ConfigureNamesBool[] =
800800
NULL
801801
},
802802
&Debug_pretty_print,
803-
false,NULL,NULL
803+
true,NULL,NULL
804804
},
805805
{
806806
{"log_parser_stats",PGC_SUSET,STATS_MONITORING,

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@
322322
#debug_print_parse = off
323323
#debug_print_rewritten = off
324324
#debug_print_plan = off
325-
#debug_pretty_print =off
325+
#debug_pretty_print =on
326326
#log_checkpoints = off
327327
#log_connections = off
328328
#log_disconnections = off

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp