{"kind": "hook", "major": "18", "item": {"slug": "explain_per_plan_hook", "name": "explain_per_plan_hook", "name_zh": "explain_per_plan_hook", "category": "EXPLAIN", "summary": "Hook for EXPLAIN plugins to print extra information for each plan", "aliases": [], "versions": {"18": {"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": [{"url": "/docs/sql/explain/?v=18", "label": "EXPLAIN"}], "release": {"ref": "REL_18_STABLE", "label": "18", "major": "18", "channel": "stable", "revision": "753057e340da8f22e57c9a409ea7a235fd6a46bd"}, "sources": [{"url": "https://github.com/postgres/postgres/blob/753057e340da8f22e57c9a409ea7a235fd6a46bd/src/include/commands/explain.h#L32", "path": "src/include/commands/explain.h", "label": "Interface declaration", "sha256": "a8ef9548bccebb3c8f5255e8295d1d53dd0e4ea54b6be8b17dfe163ef2918b7f"}, {"url": "https://github.com/postgres/postgres/blob/753057e340da8f22e57c9a409ea7a235fd6a46bd/src/backend/commands/explain.c#L56", "path": "src/backend/commands/explain.c", "label": "Core definition", "sha256": "34c86d6070224a0e981efef51f79101d6d505e5874f1684ace183034bab14bb4"}, {"url": "https://github.com/postgres/postgres/blob/753057e340da8f22e57c9a409ea7a235fd6a46bd/src/backend/commands/explain.c#L650", "path": "src/backend/commands/explain.c", "label": "Call sites", "sha256": "34c86d6070224a0e981efef51f79101d6d505e5874f1684ace183034bab14bb4"}], "sections": [{"title": "Core source comments", "paragraphs": ["per-plan and per-node hooks for plugins to print additional info", "Allow plugins to print additional information"]}, {"title": "Call sites", "paragraphs": ["src/backend/commands/explain.c:650"]}, {"code": "\t/* Print info about serialization of output */\n\tif (es->serialize != EXPLAIN_SERIALIZE_NONE)\n\t\tExplainPrintSerialize(es, &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", "title": "Core call context: src/backend/commands/explain.c:644\u2013658", "paragraphs": []}], "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;", "description": ["Hook for EXPLAIN plugins to print extra information for each plan"]}, "19": {"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": [{"url": "/docs/sql/explain/?v=19", "label": "EXPLAIN"}], "release": {"ref": "REL_19_BETA4", "label": "19 Beta 4", "major": "19", "channel": "preview", "revision": "b73d13c32c834a2c8e1c60cb92f79530376cedf1"}, "sources": [{"url": "https://github.com/postgres/postgres/blob/b73d13c32c834a2c8e1c60cb92f79530376cedf1/src/include/commands/explain.h#L33", "path": "src/include/commands/explain.h", "label": "Interface declaration", "sha256": "469d0dad433271caace897340b6bd44dd89b27c255687cfbf89e5050926f9c82"}, {"url": "https://github.com/postgres/postgres/blob/b73d13c32c834a2c8e1c60cb92f79530376cedf1/src/backend/commands/explain.c#L58", "path": "src/backend/commands/explain.c", "label": "Core definition", "sha256": "8b115b1c194a4b54ae630209a741e293b1df49a9052f10b2de9ca092a48998e3"}, {"url": "https://github.com/postgres/postgres/blob/b73d13c32c834a2c8e1c60cb92f79530376cedf1/src/backend/commands/explain.c#L658", "path": "src/backend/commands/explain.c", "label": "Call sites", "sha256": "8b115b1c194a4b54ae630209a741e293b1df49a9052f10b2de9ca092a48998e3"}], "sections": [{"title": "Core source comments", "paragraphs": ["per-plan and per-node hooks for plugins to print additional info", "Allow plugins to print additional information"]}, {"title": "Call sites", "paragraphs": ["src/backend/commands/explain.c:658"]}, {"code": "\t/* Print info about serialization of output */\n\tif (es->serialize != EXPLAIN_SERIALIZE_NONE)\n\t\tExplainPrintSerialize(es, &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", "title": "Core call context: src/backend/commands/explain.c:652\u2013666", "paragraphs": []}], "signature": "typedef void (*explain_per_plan_hook_type) (PlannedStmt *plannedstmt, IntoClause *into, ExplainState *es, const char *queryString, ParamListInfo params, QueryEnvironment *queryEnv);\nextern PGDLLIMPORT explain_per_plan_hook_type explain_per_plan_hook;", "description": ["Hook for EXPLAIN plugins to print extra information for each plan"]}, "20": {"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": [{"url": "/docs/sql/explain/?v=20", "label": "EXPLAIN"}], "release": {"ref": "master", "label": "20 devel", "major": "20", "channel": "devel", "revision": "2c10c2ce4d7bcd57543a49ab402af02a39724e0a"}, "sources": [{"url": "https://github.com/postgres/postgres/blob/2c10c2ce4d7bcd57543a49ab402af02a39724e0a/src/include/commands/explain.h#L33", "path": "src/include/commands/explain.h", "label": "Interface declaration", "sha256": "469d0dad433271caace897340b6bd44dd89b27c255687cfbf89e5050926f9c82"}, {"url": "https://github.com/postgres/postgres/blob/2c10c2ce4d7bcd57543a49ab402af02a39724e0a/src/backend/commands/explain.c#L58", "path": "src/backend/commands/explain.c", "label": "Core definition", "sha256": "13402758013520451539427b5993db06d463ca11c4e2d4cc5444e82367688077"}, {"url": "https://github.com/postgres/postgres/blob/2c10c2ce4d7bcd57543a49ab402af02a39724e0a/src/backend/commands/explain.c#L658", "path": "src/backend/commands/explain.c", "label": "Call sites", "sha256": "13402758013520451539427b5993db06d463ca11c4e2d4cc5444e82367688077"}], "sections": [{"title": "Core source comments", "paragraphs": ["per-plan and per-node hooks for plugins to print additional info", "Allow plugins to print additional information"]}, {"title": "Call sites", "paragraphs": ["src/backend/commands/explain.c:658"]}, {"code": "\t/* Print info about serialization of output */\n\tif (es->serialize != EXPLAIN_SERIALIZE_NONE)\n\t\tExplainPrintSerialize(es, &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", "title": "Core call context: src/backend/commands/explain.c:652\u2013666", "paragraphs": []}], "signature": "typedef void (*explain_per_plan_hook_type) (PlannedStmt *plannedstmt, IntoClause *into, ExplainState *es, const char *queryString, ParamListInfo params, QueryEnvironment *queryEnv);\nextern PGDLLIMPORT explain_per_plan_hook_type explain_per_plan_hook;", "description": ["Hook for EXPLAIN plugins to print extra information for each plan"]}}, "content_hash": "d91df21bc1613e4e9a061b0524953e60edcb50e861940e821d3726c5df8cf138", "imported_at": "2026-09-27T09:57:58.836"}, "snapshot": {"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": [{"url": "/docs/sql/explain/?v=18", "label": "EXPLAIN"}], "release": {"ref": "REL_18_STABLE", "label": "18", "major": "18", "channel": "stable", "revision": "753057e340da8f22e57c9a409ea7a235fd6a46bd"}, "sources": [{"url": "https://github.com/postgres/postgres/blob/753057e340da8f22e57c9a409ea7a235fd6a46bd/src/include/commands/explain.h#L32", "path": "src/include/commands/explain.h", "label": "Interface declaration", "sha256": "a8ef9548bccebb3c8f5255e8295d1d53dd0e4ea54b6be8b17dfe163ef2918b7f"}, {"url": "https://github.com/postgres/postgres/blob/753057e340da8f22e57c9a409ea7a235fd6a46bd/src/backend/commands/explain.c#L56", "path": "src/backend/commands/explain.c", "label": "Core definition", "sha256": "34c86d6070224a0e981efef51f79101d6d505e5874f1684ace183034bab14bb4"}, {"url": "https://github.com/postgres/postgres/blob/753057e340da8f22e57c9a409ea7a235fd6a46bd/src/backend/commands/explain.c#L650", "path": "src/backend/commands/explain.c", "label": "Call sites", "sha256": "34c86d6070224a0e981efef51f79101d6d505e5874f1684ace183034bab14bb4"}], "sections": [{"title": "Core source comments", "paragraphs": ["per-plan and per-node hooks for plugins to print additional info", "Allow plugins to print additional information"]}, {"title": "Call sites", "paragraphs": ["src/backend/commands/explain.c:650"]}, {"code": "\t/* Print info about serialization of output */\n\tif (es->serialize != EXPLAIN_SERIALIZE_NONE)\n\t\tExplainPrintSerialize(es, &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", "title": "Core call context: src/backend/commands/explain.c:644\u2013658", "paragraphs": []}], "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;", "description": ["Hook for EXPLAIN plugins to print extra information for each plan"]}, "comparison": {"left": "18", "right": "19", "status": "changed", "diff": "--- PostgreSQL 18\n+++ PostgreSQL 19\n@@ -17,6 +17,6 @@\n       \"value\": \"NULL (no hook installed)\"\n     }\n   ],\n-  \"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;\",\n+  \"signature\": \"typedef void (*explain_per_plan_hook_type) (PlannedStmt *plannedstmt, IntoClause *into, ExplainState *es, const char *queryString, ParamListInfo params, QueryEnvironment *queryEnv);\\nextern PGDLLIMPORT explain_per_plan_hook_type explain_per_plan_hook;\",\n   \"tables\": null\n }"}}