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

Commit765dd2a

Browse files
committed
explain change
1 parentbf6fdee commit765dd2a

File tree

3 files changed

+23
-13
lines changed

3 files changed

+23
-13
lines changed

‎src/backend/commands/explain.c

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/commands/explain.c,v 1.6 1996/12/2900:53:20 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/commands/explain.c,v 1.7 1996/12/2919:30:55 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -27,8 +27,8 @@
2727

2828
typedefstructExplainState {
2929
/* options */
30-
intprintCost;/* print cost */
31-
intprintNodes;/* do nodeToString() instead */
30+
boolprintCost;/* print cost */
31+
boolprintNodes;/* do nodeToString() instead */
3232
/* other states */
3333
List*rtable;/* range table */
3434
}ExplainState;
@@ -69,18 +69,25 @@ ExplainQuery(Query *query, List *options, CommandDest dest)
6969
memset(es,0,sizeof(ExplainState));
7070

7171
/* parse options */
72-
es->printCost=1;/* default */
7372
while (options) {
7473
char*ostr=strVal(lfirst(options));
7574
if (!strcasecmp(ostr,"cost"))
76-
es->printCost=1;
77-
elseif (!strcasecmp(ostr,"full"))
78-
es->printNodes=1;
75+
es->printCost= true;
76+
elseif (!strcasecmp(ostr,"plan"))
77+
es->printNodes= true;
78+
elseif (!strcasecmp(ostr,"full")) {
79+
es->printCost= true;
80+
es->printNodes= true;
81+
}
7982
else
8083
elog(WARN,"Unknown EXPLAIN option: %s",ostr);
8184

8285
options=lnext(options);
8386
}
87+
88+
if (!es->printCost&& !es->printNodes)
89+
es->printCost= true;/* default */
90+
8491
es->rtable=query->rtable;
8592

8693
if (es->printNodes)

‎src/bin/psql/psqlHelp.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*
66
* Copyright (c) 1994, Regents of the University of California
77
*
8-
* $Id: psqlHelp.h,v 1.8 1996/12/2900:53:59 momjian Exp $
8+
* $Id: psqlHelp.h,v 1.9 1996/12/2919:31:06 momjian Exp $
99
*
1010
*-------------------------------------------------------------------------
1111
*/
@@ -124,7 +124,7 @@ static struct _helpStruct QL_HELP[] = {
124124
"end [transaction];"},
125125
{"explain",
126126
"explain the query execution plan",
127-
"explain [with {cost|full}] <query>"},
127+
"explain [with {cost|plan|full}] <query>"},
128128
{"fetch",
129129
"retrieve tuples from a cursor",
130130
"fetch [forward|backward] [<number>|all] [in <cursorname>];"},

‎src/man/explain.l

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
.\" This is -*-nroff-*-
22
.\" XXX standard disclaimer belongs here....
3-
.\" $Header: /cvsroot/pgsql/src/man/Attic/explain.l,v 1.2 1996/12/2903:55:36 momjian Exp $
3+
.\" $Header: /cvsroot/pgsql/src/man/Attic/explain.l,v 1.3 1996/12/2919:31:16 momjian Exp $
44
.TH EXPLAIN SQL 11/05/95 PostgreSQL PostgreSQL
55
.SH NAME
66
explain\(em explains statement execution details
77
.SH SYNOPSIS
88
.nf
9-
\fBexplain[with\fP\fB{cost|full}]\fR query
9+
\fBexplain[with\fP\fB{cost|plan|full}]\fR query
1010
.fi
1111
.SH DESCRIPTION
1212
This command outputs details about the supplied query. The default
13-
output is the computed query cost.\f2full\f1 displays a full query plan
14-
and cost.
13+
output is the computed query cost.\f2plan\f1 displays the full query
14+
plan.\f2full\f1 display both query plan and query cost.
15+
.PP
16+
The query cost and plan can be affected by running vacuum.
17+

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp