{"Entry":{"collection":"hook","key":"explain_per_plan_hook","name":"explain_per_plan_hook","aliases":[],"metadata":{"aliases":[],"category":"EXPLAIN","content_hash":"d55ec38de69f573d58ad77a9cf057c2ba1e65610377ff3216659f0ccbe7e5e27","derived_content_hash":"d2cf7afdf27ba1421ecbe1f4f77df361d358d939194b9fe50569b1007c5c40e3","imported_at":"2026-09-30T17:44:22.440573+08:00","name":"explain_per_plan_hook","name_zh":"explain_per_plan_hook","repair_provenance":{"original_source_revision":"","receipt_sha256":"8e15206df235bb2928193344962dd9f13fef7059c5c70179b79b7e85e785a50a","repair":"wiki-repair-20261023"},"slug":"explain_per_plan_hook","source_rev":"wiki-repair-20261023:72ef218273d172da78a86c4481599c0d751400b3ca9086c71922c7dc198dfb59","summary":"Hook for EXPLAIN plugins to print extra information for each plan"}},"Definition":{"Collection":"hook","Key":"explain_per_plan_hook","SourceDatabase":"center","Version":"18","SourceTable":"hook","SourceKey":"explain_per_plan_hook","SourceRevision":"753057e340da8f22e57c9a409ea7a235fd6a46bd","Facts":{"description":["Hook for EXPLAIN plugins to print extra information for each plan"],"description_zh":"供 EXPLAIN 插件为每个计划输出额外信息的钩子。","description_zh_html":"\u003cp\u003e供 EXPLAIN 插件为每个计划输出额外信息的钩子。\u003c/p\u003e\u003cp\u003e以下中文为本站依据所列 PostgreSQL 源码注释编译的说明。\u003c/p\u003e\u003ch3\u003e接口声明\u003c/h3\u003e\u003cpre\u003etypedef void (*explain_per_plan_hook_type) (PlannedStmt *plannedstmt, IntoClause *into, struct ExplainState *es, const char *queryString, ParamListInfo params, QueryEnvironment *queryEnv);\nextern PGDLLIMPORT explain_per_plan_hook_type explain_per_plan_hook;\u003c/pre\u003e\u003ch3\u003e源码说明\u003c/h3\u003e\u003cp\u003e按计划和按节点调用的钩子，供插件输出额外信息。\u003c/p\u003e\u003cp\u003e允许插件输出额外信息。\u003c/p\u003e\u003ch3\u003e调用位置\u003c/h3\u003e\u003cul\u003e\u003cli\u003e\u003ccode\u003esrc/backend/commands/explain.c:650\u003c/code\u003e\u003c/li\u003e\u003c/ul\u003e\u003ch3\u003e核心调用上下文：src/backend/commands/explain.c:644–658\u003c/h3\u003e\u003cpre\u003e\t/* Print info about serialization of output */\n\tif (es-\u0026gt;serialize != EXPLAIN_SERIALIZE_NONE)\n\t\tExplainPrintSerialize(es, \u0026amp;serializeMetrics);\n\n\t/* Allow plugins to print additional information */\n\tif (explain_per_plan_hook)\n\t\t(*explain_per_plan_hook) (plannedstmt, into, es, queryString,\n\t\t\t\t\t\t\t\t  params, queryEnv);\n\n\t/*\n\t * Close down the query and free resources.  Include time for this in the\n\t * total execution time (although it should be pretty minimal).\n\t */\n\tINSTR_TIME_SET_CURRENT(starttime);\n\u003c/pre\u003e","facts":[{"label":"Interface type","value":"explain_per_plan_hook_type"},{"label":"Header","value":"src/include/commands/explain.h"},{"label":"Subsystem","value":"EXPLAIN"},{"label":"Initial value","value":"NULL (no hook installed)"}],"related":[{"label":"EXPLAIN","url":"/wiki/sql/explain/?v=18"}],"release":{"channel":"stable","label":"18","major":"18","ref":"REL_18_STABLE","revision":"753057e340da8f22e57c9a409ea7a235fd6a46bd"},"sections":[{"paragraphs":["per-plan and per-node hooks for plugins to print additional info","Allow plugins to print additional information"],"title":"Core source comments"},{"paragraphs":["src/backend/commands/explain.c:650"],"title":"Call sites"},{"code":"\t/* Print info about serialization of output */\n\tif (es-\u003eserialize != EXPLAIN_SERIALIZE_NONE)\n\t\tExplainPrintSerialize(es, \u0026serializeMetrics);\n\n\t/* Allow plugins to print additional information */\n\tif (explain_per_plan_hook)\n\t\t(*explain_per_plan_hook) (plannedstmt, into, es, queryString,\n\t\t\t\t\t\t\t\t  params, queryEnv);\n\n\t/*\n\t * Close down the query and free resources.  Include time for this in the\n\t * total execution time (although it should be pretty minimal).\n\t */\n\tINSTR_TIME_SET_CURRENT(starttime);\n","paragraphs":[],"title":"Core call context: src/backend/commands/explain.c:644–658"}],"signature":"typedef void (*explain_per_plan_hook_type) (PlannedStmt *plannedstmt, IntoClause *into, struct ExplainState *es, const char *queryString, ParamListInfo params, QueryEnvironment *queryEnv);\nextern PGDLLIMPORT explain_per_plan_hook_type explain_per_plan_hook;","sources":[{"label":"Interface declaration","path":"src/include/commands/explain.h","sha256":"a8ef9548bccebb3c8f5255e8295d1d53dd0e4ea54b6be8b17dfe163ef2918b7f","url":"https://github.com/postgres/postgres/blob/753057e340da8f22e57c9a409ea7a235fd6a46bd/src/include/commands/explain.h#L32"},{"label":"Core definition","path":"src/backend/commands/explain.c","sha256":"34c86d6070224a0e981efef51f79101d6d505e5874f1684ace183034bab14bb4","url":"https://github.com/postgres/postgres/blob/753057e340da8f22e57c9a409ea7a235fd6a46bd/src/backend/commands/explain.c#L56"},{"label":"Call sites","path":"src/backend/commands/explain.c","sha256":"34c86d6070224a0e981efef51f79101d6d505e5874f1684ace183034bab14bb4","url":"https://github.com/postgres/postgres/blob/753057e340da8f22e57c9a409ea7a235fd6a46bd/src/backend/commands/explain.c#L650"}],"translation_provenance":{"inputs":[{"label":"Interface declaration","path":"src/include/commands/explain.h","sha256":"a8ef9548bccebb3c8f5255e8295d1d53dd0e4ea54b6be8b17dfe163ef2918b7f","url":"https://github.com/postgres/postgres/blob/753057e340da8f22e57c9a409ea7a235fd6a46bd/src/include/commands/explain.h#L32"},{"label":"Core definition","path":"src/backend/commands/explain.c","sha256":"34c86d6070224a0e981efef51f79101d6d505e5874f1684ace183034bab14bb4","url":"https://github.com/postgres/postgres/blob/753057e340da8f22e57c9a409ea7a235fd6a46bd/src/backend/commands/explain.c#L56"},{"label":"Call sites","path":"src/backend/commands/explain.c","sha256":"34c86d6070224a0e981efef51f79101d6d505e5874f1684ace183034bab14bb4","url":"https://github.com/postgres/postgres/blob/753057e340da8f22e57c9a409ea7a235fd6a46bd/src/backend/commands/explain.c#L650"}],"kind":"authored-source-translation","locale":"zh-Hans","source_revision":"753057e340da8f22e57c9a409ea7a235fd6a46bd","translated_source_sha256":"171bfc75d2d75c50fb3ce54891ad7459a7dbc4641f36cec486905e08d09fd83d","version":"18"},"zh_from":"authored-source-translation"},"ManualEvidence":{"release":{"channel":"stable","label":"18","major":"18","ref":"REL_18_STABLE","revision":"753057e340da8f22e57c9a409ea7a235fd6a46bd"},"sources":[{"label":"Interface declaration","path":"src/include/commands/explain.h","sha256":"a8ef9548bccebb3c8f5255e8295d1d53dd0e4ea54b6be8b17dfe163ef2918b7f","url":"https://github.com/postgres/postgres/blob/753057e340da8f22e57c9a409ea7a235fd6a46bd/src/include/commands/explain.h#L32"},{"label":"Core definition","path":"src/backend/commands/explain.c","sha256":"34c86d6070224a0e981efef51f79101d6d505e5874f1684ace183034bab14bb4","url":"https://github.com/postgres/postgres/blob/753057e340da8f22e57c9a409ea7a235fd6a46bd/src/backend/commands/explain.c#L56"},{"label":"Call sites","path":"src/backend/commands/explain.c","sha256":"34c86d6070224a0e981efef51f79101d6d505e5874f1684ace183034bab14bb4","url":"https://github.com/postgres/postgres/blob/753057e340da8f22e57c9a409ea7a235fd6a46bd/src/backend/commands/explain.c#L650"}]},"MeasuredEvidence":{}},"Text":{"Collection":"hook","Key":"explain_per_plan_hook","SourceDatabase":"center","Version":"18","Locale":"en","Title":"explain_per_plan_hook","Summary":"Hook for EXPLAIN plugins to print extra information for each plan","BodyHTML":"\u003cp\u003eHook for EXPLAIN plugins to print extra information for each plan\u003c/p\u003e","SourceRevision":"753057e340da8f22e57c9a409ea7a235fd6a46bd","ContentHash":"e2369c4fcf22777e33448479912322ad51d205895c9738c3bcbff35e76ec19f2","Payload":{"description":["Hook for EXPLAIN plugins to print extra information for each plan"],"related":[{"label":"EXPLAIN","url":"/wiki/sql/explain/?v=18"}],"sections":[{"paragraphs":["per-plan and per-node hooks for plugins to print additional info","Allow plugins to print additional information"],"title":"Core source comments"},{"paragraphs":["src/backend/commands/explain.c:650"],"title":"Call sites"},{"code":"\t/* Print info about serialization of output */\n\tif (es-\u003eserialize != EXPLAIN_SERIALIZE_NONE)\n\t\tExplainPrintSerialize(es, \u0026serializeMetrics);\n\n\t/* Allow plugins to print additional information */\n\tif (explain_per_plan_hook)\n\t\t(*explain_per_plan_hook) (plannedstmt, into, es, queryString,\n\t\t\t\t\t\t\t\t  params, queryEnv);\n\n\t/*\n\t * Close down the query and free resources.  Include time for this in the\n\t * total execution time (although it should be pretty minimal).\n\t */\n\tINSTR_TIME_SET_CURRENT(starttime);\n","paragraphs":[],"title":"Core call context: src/backend/commands/explain.c:644–658"}]}},"RequestedLocale":"en","Fallback":false,"Versions":["18","19","20"],"Locales":["en","zh-Hans"],"Signatures":null,"Spellings":null,"SQLState":null,"Evidence":null}
