/* Hook for plugins to get control in explain_get_index_name() */
explain_get_index_name_hook_type explain_get_index_name_hook = NULL;
+/* per-plan and per-node hooks for plugins to print additional info */
+explain_per_plan_hook_type explain_per_plan_hook = NULL;
+explain_per_node_hook_type explain_per_node_hook = NULL;
/*
* Various places within need to convert bytes to kilobytes. Round these up
if (es->serialize != EXPLAIN_SERIALIZE_NONE)
ExplainPrintSerialize(es, &serializeMetrics);
+ /* Allow plugins to print additional information */
+ if (explain_per_plan_hook)
+ (*explain_per_plan_hook) (plannedstmt, into, es, queryString,
+ params, queryEnv);
+
/*
* Close down the query and free resources. Include time for this in the
* total execution time (although it should be pretty minimal).
ExplainFlushWorkersState(es);
es->workers_state = save_workers_state;
+ /* Allow plugins to print additional information */
+ if (explain_per_node_hook)
+ (*explain_per_node_hook) (planstate, ancestors, relationship,
+ plan_name, es);
+
/*
* If partition pruning was done during executor initialization, the
* number of child plans we'll display below will be less than the number
QueryEnvironment *queryEnv);
extern PGDLLIMPORT ExplainOneQuery_hook_type ExplainOneQuery_hook;
+/* Hook for EXPLAIN plugins to print extra information for each plan */
+typedef void (*explain_per_plan_hook_type) (PlannedStmt *plannedstmt,
+ IntoClause *into,
+ struct ExplainState *es,
+ const char *queryString,
+ ParamListInfo params,
+ QueryEnvironment *queryEnv);
+extern PGDLLIMPORT explain_per_plan_hook_type explain_per_plan_hook;
+
+/* Hook for EXPLAIN plugins to print extra fields on individual plan nodes */
+typedef void (*explain_per_node_hook_type) (PlanState *planstate,
+ List *ancestors,
+ const char *relationship,
+ const char *plan_name,
+ struct ExplainState *es);
+extern PGDLLIMPORT explain_per_node_hook_type explain_per_node_hook;
+
/* Hook for plugins to get control in explain_get_index_name() */
typedef const char *(*explain_get_index_name_hook_type) (Oid indexId);
extern PGDLLIMPORT explain_get_index_name_hook_type explain_get_index_name_hook;