↑↓ select ↵ open ⌫ change scope Open full search

PG.CENTER connects PostgreSQL documentation, reference, and ecosystem knowledge. Maintained by Pigsty.

Documentation / Extension Hooks / EXPLAIN

explain_per_plan_hook

explain_per_plan_hook

Hook for EXPLAIN plugins to print extra information for each plan

Reading PostgreSQL 18.

Description

Hook for EXPLAIN plugins to print extra information for each plan

Interface type
explain_per_plan_hook_type
Header
src/include/commands/explain.h
Subsystem
EXPLAIN
Initial value
NULL (no hook installed)

C interface

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;

Core source comments

per-plan and per-node hooks for plugins to print additional info

Allow plugins to print additional information

Call sites

src/backend/commands/explain.c:650

Core call context: 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);

Related entries

Documentation and source

Source build
Version
18
Build
REL_18_STABLE
Source fingerprint
753057e340da8f22e57c9a409ea7a235fd6a46bd

Related entries

Back to Extension Hooks · Recorded in PostgreSQL 18 through 20; the first sample is not necessarily its introduction.