1 /*-------------------------------------------------------------------------
4 * prototypes for explain.c
6 * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
7 * Portions Copyright (c) 1994-5, Regents of the University of California
9 * src/include/commands/explain.h
11 *-------------------------------------------------------------------------
16 #include "executor/executor.h"
17 #include "lib/stringinfo.h"
19 typedef enum ExplainFormat
27 typedef struct ExplainState
29 StringInfo str; /* output buffer */
31 bool verbose; /* be verbose */
32 bool analyze; /* print actual times */
33 bool costs; /* print estimated costs */
34 bool buffers; /* print buffer usage */
35 bool timing; /* print detailed node timing */
36 bool summary; /* print total planning and execution timing */
37 ExplainFormat format; /* output format */
39 PlannedStmt *pstmt; /* top of plan */
40 List *rtable; /* range table */
41 List *rtable_names; /* alias names for RTEs */
42 int indent; /* current indentation level */
43 List *grouping_stack; /* format-specific grouping state */
44 List *deparse_cxt; /* context list for deparsing expressions */
47 /* Hook for plugins to get control in ExplainOneQuery() */
48 typedef void (*ExplainOneQuery_hook_type) (Query *query,
51 const char *queryString,
52 ParamListInfo params);
53 extern PGDLLIMPORT ExplainOneQuery_hook_type ExplainOneQuery_hook;
55 /* Hook for plugins to get control in explain_get_index_name() */
56 typedef const char *(*explain_get_index_name_hook_type) (Oid indexId);
57 extern PGDLLIMPORT explain_get_index_name_hook_type explain_get_index_name_hook;
60 extern void ExplainQuery(ExplainStmt *stmt, const char *queryString,
61 ParamListInfo params, DestReceiver *dest);
63 extern ExplainState *NewExplainState(void);
65 extern TupleDesc ExplainResultDesc(ExplainStmt *stmt);
67 extern void ExplainOneUtility(Node *utilityStmt, IntoClause *into,
69 const char *queryString, ParamListInfo params);
71 extern void ExplainOnePlan(PlannedStmt *plannedstmt, IntoClause *into,
72 ExplainState *es, const char *queryString,
73 ParamListInfo params, const instr_time *planduration);
75 extern void ExplainPrintPlan(ExplainState *es, QueryDesc *queryDesc);
76 extern void ExplainPrintTriggers(ExplainState *es, QueryDesc *queryDesc);
78 extern void ExplainQueryText(ExplainState *es, QueryDesc *queryDesc);
80 extern void ExplainBeginOutput(ExplainState *es);
81 extern void ExplainEndOutput(ExplainState *es);
82 extern void ExplainSeparatePlans(ExplainState *es);
84 extern void ExplainPropertyList(const char *qlabel, List *data,
86 extern void ExplainPropertyListNested(const char *qlabel, List *data,
88 extern void ExplainPropertyText(const char *qlabel, const char *value,
90 extern void ExplainPropertyInteger(const char *qlabel, int value,
92 extern void ExplainPropertyLong(const char *qlabel, long value,
94 extern void ExplainPropertyFloat(const char *qlabel, double value, int ndigits,
97 #endif /* EXPLAIN_H */