Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes15kdownloads
explain.h130 linesDownload Raw Back to commands
1/*-------------------------------------------------------------------------2 *3 * explain.h4 *	  prototypes for explain.c5 *6 * Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group7 * Portions Copyright (c) 1994-5, Regents of the University of California8 *9 * src/include/commands/explain.h10 *11 *-------------------------------------------------------------------------12 */13#ifndef EXPLAIN_H14#define EXPLAIN_H15 16#include "executor/executor.h"17#include "lib/stringinfo.h"18#include "parser/parse_node.h"19 20typedef enum ExplainFormat21{22	EXPLAIN_FORMAT_TEXT,23	EXPLAIN_FORMAT_XML,24	EXPLAIN_FORMAT_JSON,25	EXPLAIN_FORMAT_YAML26} ExplainFormat;27 28typedef struct ExplainWorkersState29{30	int			num_workers;	/* # of worker processes the plan used */31	bool	   *worker_inited;	/* per-worker state-initialized flags */32	StringInfoData *worker_str; /* per-worker transient output buffers */33	int		   *worker_state_save;	/* per-worker grouping state save areas */34	StringInfo	prev_str;		/* saved output buffer while redirecting */35} ExplainWorkersState;36 37typedef struct ExplainState38{39	StringInfo	str;			/* output buffer */40	/* options */41	bool		verbose;		/* be verbose */42	bool		analyze;		/* print actual times */43	bool		costs;			/* print estimated costs */44	bool		buffers;		/* print buffer usage */45	bool		wal;			/* print WAL usage */46	bool		timing;			/* print detailed node timing */47	bool		summary;		/* print total planning and execution timing */48	bool		settings;		/* print modified settings */49	bool		generic;		/* generate a generic plan */50	ExplainFormat format;		/* output format */51	/* state for output formatting --- not reset for each new plan tree */52	int			indent;			/* current indentation level */53	List	   *grouping_stack; /* format-specific grouping state */54	/* state related to the current plan tree (filled by ExplainPrintPlan) */55	PlannedStmt *pstmt;			/* top of plan */56	List	   *rtable;			/* range table */57	List	   *rtable_names;	/* alias names for RTEs */58	List	   *deparse_cxt;	/* context list for deparsing expressions */59	Bitmapset  *printed_subplans;	/* ids of SubPlans we've printed */60	bool		hide_workers;	/* set if we find an invisible Gather */61	/* state related to the current plan node */62	ExplainWorkersState *workers_state; /* needed if parallel plan */63} ExplainState;64 65/* Hook for plugins to get control in ExplainOneQuery() */66typedef void (*ExplainOneQuery_hook_type) (Query *query,67										   int cursorOptions,68										   IntoClause *into,69										   ExplainState *es,70										   const char *queryString,71										   ParamListInfo params,72										   QueryEnvironment *queryEnv);73extern PGDLLIMPORT ExplainOneQuery_hook_type ExplainOneQuery_hook;74 75/* Hook for plugins to get control in explain_get_index_name() */76typedef const char *(*explain_get_index_name_hook_type) (Oid indexId);77extern PGDLLIMPORT explain_get_index_name_hook_type explain_get_index_name_hook;78 79 80extern void ExplainQuery(ParseState *pstate, ExplainStmt *stmt,81						 ParamListInfo params, DestReceiver *dest);82 83extern ExplainState *NewExplainState(void);84 85extern TupleDesc ExplainResultDesc(ExplainStmt *stmt);86 87extern void ExplainOneUtility(Node *utilityStmt, IntoClause *into,88							  ExplainState *es, const char *queryString,89							  ParamListInfo params, QueryEnvironment *queryEnv);90 91extern void ExplainOnePlan(PlannedStmt *plannedstmt, IntoClause *into,92						   ExplainState *es, const char *queryString,93						   ParamListInfo params, QueryEnvironment *queryEnv,94						   const instr_time *planduration,95						   const BufferUsage *bufusage);96 97extern void ExplainPrintPlan(ExplainState *es, QueryDesc *queryDesc);98extern void ExplainPrintTriggers(ExplainState *es, QueryDesc *queryDesc);99 100extern void ExplainPrintJITSummary(ExplainState *es, QueryDesc *queryDesc);101 102extern void ExplainQueryText(ExplainState *es, QueryDesc *queryDesc);103extern void ExplainQueryParameters(ExplainState *es, ParamListInfo params, int maxlen);104 105extern void ExplainBeginOutput(ExplainState *es);106extern void ExplainEndOutput(ExplainState *es);107extern void ExplainSeparatePlans(ExplainState *es);108 109extern void ExplainPropertyList(const char *qlabel, List *data,110								ExplainState *es);111extern void ExplainPropertyListNested(const char *qlabel, List *data,112									  ExplainState *es);113extern void ExplainPropertyText(const char *qlabel, const char *value,114								ExplainState *es);115extern void ExplainPropertyInteger(const char *qlabel, const char *unit,116								   int64 value, ExplainState *es);117extern void ExplainPropertyUInteger(const char *qlabel, const char *unit,118									uint64 value, ExplainState *es);119extern void ExplainPropertyFloat(const char *qlabel, const char *unit,120								 double value, int ndigits, ExplainState *es);121extern void ExplainPropertyBool(const char *qlabel, bool value,122								ExplainState *es);123 124extern void ExplainOpenGroup(const char *objtype, const char *labelname,125							 bool labeled, ExplainState *es);126extern void ExplainCloseGroup(const char *objtype, const char *labelname,127							  bool labeled, ExplainState *es);128 129#endif							/* EXPLAIN_H */130 
codekingpro/portable-devtools · Team Ai