explain_with_indexes
Analyze PostgreSQL query performance with proposed indexes before implementation. Compare execution plans to determine if new indexes would improve performance without creating them.
Instructions
Run EXPLAIN on a query, optionally with hypothetical indexes.
This tool allows you to see how a query would perform with proposed indexes WITHOUT actually creating them. Requires HypoPG extension for hypothetical testing.
Use this to:
Compare execution plans with and without specific indexes
Test if a proposed index would be used
Estimate the performance impact of new indexes
Returns both the original and hypothetical execution plans for comparison.
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": {
"query": "<query>"
},
"name": "explain_with_indexes"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | The SQL query to explain | |
| hypothetical_indexes | No | List of hypothetical indexes to test | |
| analyze | No | Whether to use EXPLAIN ANALYZE (executes the query) |