explain change
This commit is contained in:
parent
bf6fdeebb5
commit
765dd2a4c0
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/explain.c,v 1.6 1996/12/29 00:53:20 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/explain.c,v 1.7 1996/12/29 19:30:55 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -27,8 +27,8 @@
|
||||
|
||||
typedef struct ExplainState {
|
||||
/* options */
|
||||
int printCost; /* print cost */
|
||||
int printNodes; /* do nodeToString() instead */
|
||||
bool printCost; /* print cost */
|
||||
bool printNodes; /* do nodeToString() instead */
|
||||
/* other states */
|
||||
List *rtable; /* range table */
|
||||
} ExplainState;
|
||||
@ -69,18 +69,25 @@ ExplainQuery(Query *query, List *options, CommandDest dest)
|
||||
memset(es, 0, sizeof(ExplainState));
|
||||
|
||||
/* parse options */
|
||||
es->printCost = 1; /* default */
|
||||
while (options) {
|
||||
char *ostr = strVal(lfirst(options));
|
||||
if (!strcasecmp(ostr, "cost"))
|
||||
es->printCost = 1;
|
||||
else if (!strcasecmp(ostr, "full"))
|
||||
es->printNodes = 1;
|
||||
es->printCost = true;
|
||||
else if (!strcasecmp(ostr, "plan"))
|
||||
es->printNodes = true;
|
||||
else if (!strcasecmp(ostr, "full")) {
|
||||
es->printCost = true;
|
||||
es->printNodes = true;
|
||||
}
|
||||
else
|
||||
elog(WARN, "Unknown EXPLAIN option: %s", ostr);
|
||||
|
||||
options = lnext(options);
|
||||
}
|
||||
|
||||
if (!es->printCost && !es->printNodes)
|
||||
es->printCost = true; /* default */
|
||||
|
||||
es->rtable = query->rtable;
|
||||
|
||||
if (es->printNodes)
|
||||
|
@ -5,7 +5,7 @@
|
||||
*
|
||||
* Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Id: psqlHelp.h,v 1.8 1996/12/29 00:53:59 momjian Exp $
|
||||
* $Id: psqlHelp.h,v 1.9 1996/12/29 19:31:06 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -124,7 +124,7 @@ static struct _helpStruct QL_HELP[] = {
|
||||
"end [transaction];"},
|
||||
{ "explain",
|
||||
"explain the query execution plan",
|
||||
"explain [with {cost|full}] <query>"},
|
||||
"explain [with {cost|plan|full}] <query>"},
|
||||
{ "fetch",
|
||||
"retrieve tuples from a cursor",
|
||||
"fetch [forward|backward] [<number>|all] [in <cursorname>];"},
|
||||
|
@ -1,14 +1,17 @@
|
||||
.\" This is -*-nroff-*-
|
||||
.\" XXX standard disclaimer belongs here....
|
||||
.\" $Header: /cvsroot/pgsql/src/man/Attic/explain.l,v 1.2 1996/12/29 03:55:36 momjian Exp $
|
||||
.\" $Header: /cvsroot/pgsql/src/man/Attic/explain.l,v 1.3 1996/12/29 19:31:16 momjian Exp $
|
||||
.TH EXPLAIN SQL 11/05/95 PostgreSQL PostgreSQL
|
||||
.SH NAME
|
||||
explain \(em explains statement execution details
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
\fBexplain [with\fP \fB{cost|full}]\fR query
|
||||
\fBexplain [with\fP \fB{cost|plan|full}]\fR query
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
This command outputs details about the supplied query. The default
|
||||
output is the computed query cost. \f2full\f1 displays a full query plan
|
||||
and cost.
|
||||
output is the computed query cost. \f2plan\f1 displays the full query
|
||||
plan. \f2full\f1 display both query plan and query cost.
|
||||
.PP
|
||||
The query cost and plan can be affected by running vacuum.
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user