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

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

百科 / 扩展钩子 / 查询规划

get_relation_info_hook

关系规划信息

供插件在 get_relation_info() 中接管处理的钩子。

当前查看 PostgreSQL 18。

中文定义与说明

供插件在 get_relation_info() 中接管处理的钩子。

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

接口声明

typedef void (*get_relation_info_hook_type) (PlannerInfo *root, Oid relationObjectId, bool inhparent, RelOptInfo *rel);
extern PGDLLIMPORT get_relation_info_hook_type get_relation_info_hook;

源码说明

允许插件调整从系统目录取得的信息,例如改变假定的关系大小、移除索引,或向 indexlist 加入假想索引。

调用位置

  • src/backend/optimizer/util/plancat.c:575

核心调用上下文:src/backend/optimizer/util/plancat.c:569–583

	/*
	 * Allow a plugin to editorialize on the info we obtained from the
	 * catalogs.  Actions might include altering the assumed relation size,
	 * removing an index, or adding a hypothetical index to the indexlist.
	 */
	if (get_relation_info_hook)
		(*get_relation_info_hook) (root, relationObjectId, inhparent, rel);
}

/*
 * get_relation_foreign_keys -
 *	  Retrieves foreign key information for a given relation.
 *
 * ForeignKeyOptInfos for relevant foreign keys are created and added to
 * root->fkey_list.  We do this now while we have the relcache entry open.

说明

供插件在 get_relation_info() 中接管处理的钩子。

接口类型
get_relation_info_hook_type
声明头文件
src/include/optimizer/plancat.h
调用阶段
查询规划
初始值
NULL(未安装钩子)

接口签名

typedef void (*get_relation_info_hook_type) (PlannerInfo *root, Oid relationObjectId, bool inhparent, RelOptInfo *rel);
extern PGDLLIMPORT get_relation_info_hook_type get_relation_info_hook;

调用位置

src/backend/optimizer/util/plancat.c:575

相关条目

文档与源码

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

同类条目

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