Interface: QueryPlanLoggerOptions
Defined in: src/observability/QueryPlanAnalyzer.ts:64
Options for createQueryPlanLogger.
Properties
adapter
adapter:
IDbAdapter
Defined in: src/observability/QueryPlanAnalyzer.ts:69
The live adapter to issue EXPLAIN queries against. Must be the same adapter used by the DbContext.
analyze?
optionalanalyze?:boolean
Defined in: src/observability/QueryPlanAnalyzer.ts:78
When true, runs EXPLAIN ANALYZE (executes the real query for accurate timing). When false (default), runs EXPLAIN only without re-executing the query.
Caution
EXPLAIN ANALYZE actually executes the SQL — only use it on SELECT queries.
Default Value
false
thresholdMs?
optionalthresholdMs?:number
Defined in: src/observability/QueryPlanAnalyzer.ts:85
Only run the planner when actual query execution time exceeds this threshold in ms. Leave undefined to always run the planner on matching queries.
Default Value
undefined
operations?
optionaloperations?: ("SELECT"|"WITH"|"UPDATE"|"INSERT"|"DELETE"|"ALL")[]
Defined in: src/observability/QueryPlanAnalyzer.ts:91
SQL operation prefixes to analyze.
Default Value
['SELECT'] — INSERT/UPDATE/DELETE excluded by default to avoid double-execution.
warnOnSeqScan?
optionalwarnOnSeqScan?:boolean
Defined in: src/observability/QueryPlanAnalyzer.ts:97
Emit a warning log line when a Seq Scan (full table scan) is detected.
Default Value
true
colorize?
optionalcolorize?:boolean
Defined in: src/observability/QueryPlanAnalyzer.ts:103
Whether to include ANSI terminal colors in output.
Default Value
auto-detected from process.stdout.isTTY
logger?
optionallogger?: (message) =>void
Defined in: src/observability/QueryPlanAnalyzer.ts:108
Custom log destination. Defaults to console.log.
Parameters
| Parameter | Type |
|---|---|
message | string |
Returns
void
onPlan?
optionalonPlan?: (plan) =>void
Defined in: src/observability/QueryPlanAnalyzer.ts:114
Called after each plan is computed, with the structured result. Use to push plan data to a metrics pipeline or alerting system.
Parameters
| Parameter | Type |
|---|---|
plan | QueryPlanResult |
Returns
void