]> granicus.if.org Git - postgresql/blob - src/include/commands/explain.h
Remove trailing slashes from directories in find command
[postgresql] / src / include / commands / explain.h
1 /*-------------------------------------------------------------------------
2  *
3  * explain.h
4  *        prototypes for explain.c
5  *
6  * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
7  * Portions Copyright (c) 1994-5, Regents of the University of California
8  *
9  * src/include/commands/explain.h
10  *
11  *-------------------------------------------------------------------------
12  */
13 #ifndef EXPLAIN_H
14 #define EXPLAIN_H
15
16 #include "executor/executor.h"
17 #include "lib/stringinfo.h"
18
19 typedef enum ExplainFormat
20 {
21         EXPLAIN_FORMAT_TEXT,
22         EXPLAIN_FORMAT_XML,
23         EXPLAIN_FORMAT_JSON,
24         EXPLAIN_FORMAT_YAML
25 } ExplainFormat;
26
27 typedef struct ExplainState
28 {
29         StringInfo      str;                    /* output buffer */
30         /* options */
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 */
38         /* other states */
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 */
45 } ExplainState;
46
47 /* Hook for plugins to get control in ExplainOneQuery() */
48 typedef void (*ExplainOneQuery_hook_type) (Query *query,
49                                                                                                            IntoClause *into,
50                                                                                                            ExplainState *es,
51                                                                                                          const char *queryString,
52                                                                                                            ParamListInfo params);
53 extern PGDLLIMPORT ExplainOneQuery_hook_type ExplainOneQuery_hook;
54
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;
58
59
60 extern void ExplainQuery(ExplainStmt *stmt, const char *queryString,
61                          ParamListInfo params, DestReceiver *dest);
62
63 extern ExplainState *NewExplainState(void);
64
65 extern TupleDesc ExplainResultDesc(ExplainStmt *stmt);
66
67 extern void ExplainOneUtility(Node *utilityStmt, IntoClause *into,
68                                   ExplainState *es,
69                                   const char *queryString, ParamListInfo params);
70
71 extern void ExplainOnePlan(PlannedStmt *plannedstmt, IntoClause *into,
72                            ExplainState *es, const char *queryString,
73                            ParamListInfo params, const instr_time *planduration);
74
75 extern void ExplainPrintPlan(ExplainState *es, QueryDesc *queryDesc);
76 extern void ExplainPrintTriggers(ExplainState *es, QueryDesc *queryDesc);
77
78 extern void ExplainQueryText(ExplainState *es, QueryDesc *queryDesc);
79
80 extern void ExplainBeginOutput(ExplainState *es);
81 extern void ExplainEndOutput(ExplainState *es);
82 extern void ExplainSeparatePlans(ExplainState *es);
83
84 extern void ExplainPropertyList(const char *qlabel, List *data,
85                                         ExplainState *es);
86 extern void ExplainPropertyListNested(const char *qlabel, List *data,
87                                                   ExplainState *es);
88 extern void ExplainPropertyText(const char *qlabel, const char *value,
89                                         ExplainState *es);
90 extern void ExplainPropertyInteger(const char *qlabel, int value,
91                                            ExplainState *es);
92 extern void ExplainPropertyLong(const char *qlabel, long value,
93                                         ExplainState *es);
94 extern void ExplainPropertyFloat(const char *qlabel, double value, int ndigits,
95                                          ExplainState *es);
96
97 #endif   /* EXPLAIN_H */