Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #ifndef EXPLAIN_H
00014 #define EXPLAIN_H
00015
00016 #include "executor/executor.h"
00017 #include "lib/stringinfo.h"
00018
00019 typedef enum ExplainFormat
00020 {
00021 EXPLAIN_FORMAT_TEXT,
00022 EXPLAIN_FORMAT_XML,
00023 EXPLAIN_FORMAT_JSON,
00024 EXPLAIN_FORMAT_YAML
00025 } ExplainFormat;
00026
00027 typedef struct ExplainState
00028 {
00029 StringInfo str;
00030
00031 bool verbose;
00032 bool analyze;
00033 bool costs;
00034 bool buffers;
00035 bool timing;
00036 ExplainFormat format;
00037
00038 PlannedStmt *pstmt;
00039 List *rtable;
00040 List *rtable_names;
00041 int indent;
00042 List *grouping_stack;
00043 } ExplainState;
00044
00045
00046 typedef void (*ExplainOneQuery_hook_type) (Query *query,
00047 IntoClause *into,
00048 ExplainState *es,
00049 const char *queryString,
00050 ParamListInfo params);
00051 extern PGDLLIMPORT ExplainOneQuery_hook_type ExplainOneQuery_hook;
00052
00053
00054 typedef const char *(*explain_get_index_name_hook_type) (Oid indexId);
00055 extern PGDLLIMPORT explain_get_index_name_hook_type explain_get_index_name_hook;
00056
00057
00058 extern void ExplainQuery(ExplainStmt *stmt, const char *queryString,
00059 ParamListInfo params, DestReceiver *dest);
00060
00061 extern void ExplainInitState(ExplainState *es);
00062
00063 extern TupleDesc ExplainResultDesc(ExplainStmt *stmt);
00064
00065 extern void ExplainOneUtility(Node *utilityStmt, IntoClause *into,
00066 ExplainState *es,
00067 const char *queryString, ParamListInfo params);
00068
00069 extern void ExplainOnePlan(PlannedStmt *plannedstmt, IntoClause *into,
00070 ExplainState *es,
00071 const char *queryString, ParamListInfo params);
00072
00073 extern void ExplainPrintPlan(ExplainState *es, QueryDesc *queryDesc);
00074
00075 extern void ExplainQueryText(ExplainState *es, QueryDesc *queryDesc);
00076
00077 extern void ExplainBeginOutput(ExplainState *es);
00078 extern void ExplainEndOutput(ExplainState *es);
00079 extern void ExplainSeparatePlans(ExplainState *es);
00080
00081 extern void ExplainPropertyList(const char *qlabel, List *data,
00082 ExplainState *es);
00083 extern void ExplainPropertyText(const char *qlabel, const char *value,
00084 ExplainState *es);
00085 extern void ExplainPropertyInteger(const char *qlabel, int value,
00086 ExplainState *es);
00087 extern void ExplainPropertyLong(const char *qlabel, long value,
00088 ExplainState *es);
00089 extern void ExplainPropertyFloat(const char *qlabel, double value, int ndigits,
00090 ExplainState *es);
00091
00092 #endif