↑↓ 选择 ↵ 打开 ⌫ 改范围 完整检索页

pgsql.cc 提供对 postgresql.org 官网内容的中文翻译,由 Pigsty 团队维护。

百科 / 扩展钩子 / 执行计划说明

explain_per_plan_hook

EXPLAIN 计划附加信息

供 EXPLAIN 插件为每个计划输出额外信息的钩子。

当前查看 PostgreSQL 18。

中文定义与说明

供 EXPLAIN 插件为每个计划输出额外信息的钩子。

以下中文为本站依据所列 PostgreSQL 源码注释编译的说明。

接口声明

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;

源码说明

按计划和按节点调用的钩子,供插件输出额外信息。

允许插件输出额外信息。

调用位置

  • src/backend/commands/explain.c:650

核心调用上下文:src/backend/commands/explain.c:644–658

	/* Print info about serialization of output */
	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).
	 */
	INSTR_TIME_SET_CURRENT(starttime);

说明

供 EXPLAIN 插件为每个计划输出额外信息的钩子。

接口类型
explain_per_plan_hook_type
声明头文件
src/include/commands/explain.h
调用阶段
执行计划说明
初始值
NULL(未安装钩子)

接口签名

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;

调用位置

src/backend/commands/explain.c:650

相关条目

文档与源码

查看来源构建
版本
18
构建
REL_18_STABLE
来源指纹
753057e340da8f22e57c9a409ea7a235fd6a46bd

同类条目

返回扩展钩子 · 此条目的收录范围为 PostgreSQL 18 至 20;起点不一定是实际引入版本。