explain_query
Inspect PostgreSQL execution plans as parsed trees, flag sequential scans and stale statistics, and optionally execute the statement with ANALYZE for actual row counts and timings.
Instructions
Execution plan via EXPLAIN (FORMAT JSON), parsed into a tree with warnings for sequential scans and stale statistics. analyze=true physically executes the statement to get actual row counts and timings; without it there are planner estimates and no timings.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| params | No | Positional PostgreSQL parameters ($1, $2, ...). | |
| analyze | No | Run EXPLAIN ANALYZE, executing the statement. | |
| statement | Yes | SQL statement to analyze. | |
| connection_id | Yes | Connection id. See list_connections. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |