explain_query
Show a read-only query's execution plan to confirm index usage or diagnose slowness; enable analyze to collect real timings and buffer stats with bound parameters.
Instructions
Show the execution plan for a read-only query (EXPLAIN; optionally ANALYZE).
Use to confirm index usage or diagnose a slow query. analyze=true actually runs the (read-only, validated) query to collect real timings and buffer stats.
EXPLAIN the query you will ACTUALLY run: a plan for bound parameters can differ
from the plan for the same SQL with the values pasted in. Pass params with the
$1/$2/... placeholders exactly as you would to execute_read_query (real driver
binds), instead of rewriting the query with literals just to explain it.
params composes with analyze=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": {
"database": "<database>",
"sql": "<sql>"
},
"name": "explain_query"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sql | Yes | ||
| params | No | ||
| analyze | No | ||
| database | Yes |