mirror of
https://github.com/postgres/postgres.git
synced 2025-07-07 00:36:50 +03:00
Extend EXPLAIN to allow generic options to be specified.
The original syntax made it difficult to add options without making them into reserved words. This change parenthesizes the options to avoid that problem, and makes provision for an explicit (and perhaps non-Boolean) value for each option. The original syntax is still supported, but only for the two original options ANALYZE and VERBOSE. As a test case, add a COSTS option that can suppress the planner cost estimates. This may be useful for including EXPLAIN output in the regression tests, which are otherwise unable to cope with cross-platform variations in cost estimates. Robert Haas
This commit is contained in:
@ -6,7 +6,7 @@
|
||||
* Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994-5, Regents of the University of California
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/include/commands/explain.h,v 1.39 2009/06/11 14:49:11 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/include/commands/explain.h,v 1.40 2009/07/26 23:34:18 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -15,12 +15,23 @@
|
||||
|
||||
#include "executor/executor.h"
|
||||
|
||||
typedef struct ExplainState
|
||||
{
|
||||
StringInfo str; /* output buffer */
|
||||
/* options */
|
||||
bool verbose; /* print plan targetlists */
|
||||
bool analyze; /* print actual times */
|
||||
bool costs; /* print costs */
|
||||
/* other states */
|
||||
PlannedStmt *pstmt; /* top of plan */
|
||||
List *rtable; /* range table */
|
||||
} ExplainState;
|
||||
|
||||
/* Hook for plugins to get control in ExplainOneQuery() */
|
||||
typedef void (*ExplainOneQuery_hook_type) (Query *query,
|
||||
ExplainStmt *stmt,
|
||||
const char *queryString,
|
||||
ParamListInfo params,
|
||||
TupOutputState *tstate);
|
||||
ExplainState *es,
|
||||
const char *queryString,
|
||||
ParamListInfo params);
|
||||
extern PGDLLIMPORT ExplainOneQuery_hook_type ExplainOneQuery_hook;
|
||||
|
||||
/* Hook for plugins to get control in explain_get_index_name() */
|
||||
@ -31,19 +42,16 @@ extern PGDLLIMPORT explain_get_index_name_hook_type explain_get_index_name_hook;
|
||||
extern void ExplainQuery(ExplainStmt *stmt, const char *queryString,
|
||||
ParamListInfo params, DestReceiver *dest);
|
||||
|
||||
extern void ExplainInitState(ExplainState *es);
|
||||
|
||||
extern TupleDesc ExplainResultDesc(ExplainStmt *stmt);
|
||||
|
||||
extern void ExplainOneUtility(Node *utilityStmt, ExplainStmt *stmt,
|
||||
const char *queryString,
|
||||
ParamListInfo params,
|
||||
TupOutputState *tstate);
|
||||
extern void ExplainOneUtility(Node *utilityStmt, ExplainState *es,
|
||||
const char *queryString, ParamListInfo params);
|
||||
|
||||
extern void ExplainOnePlan(PlannedStmt *plannedstmt, ExplainStmt *stmt,
|
||||
const char *queryString,
|
||||
ParamListInfo params,
|
||||
TupOutputState *tstate);
|
||||
extern void ExplainOnePlan(PlannedStmt *plannedstmt, ExplainState *es,
|
||||
const char *queryString, ParamListInfo params);
|
||||
|
||||
extern void ExplainPrintPlan(StringInfo str, QueryDesc *queryDesc,
|
||||
bool analyze, bool verbose);
|
||||
extern void ExplainPrintPlan(ExplainState *es, QueryDesc *queryDesc);
|
||||
|
||||
#endif /* EXPLAIN_H */
|
||||
|
Reference in New Issue
Block a user