*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
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;
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)
*
* 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 $
*
*-------------------------------------------------------------------------
*/
"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>];"},
.\" 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.
+