pg_query_explain
View a SQL query execution plan without executing, or run EXPLAIN ANALYZE for actual timing with confirmation.
Instructions
Run EXPLAIN on a query. mode=plan (default, safe) shows the plan without executing. mode=analyze executes the statement and shows actual timing — requires confirm=true.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"target": "<target>",
"sql": "<sql>"
},
"name": "pg_query_explain"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sql | Yes | SQL query to explain | |
| mode | No | Explain mode: plan (safe) or analyze (executes, requires confirm) | plan |
| params | No | JSON array of parameter values | |
| target | Yes | Target name from ~/.dbx/targets/ | |
| confirm | No | Set to 'true' for mode=analyze (EXPLAIN ANALYZE executes the statement) |