Explain Query
explainQueryGenerate a structured execution plan for slow SQL queries to identify performance bottlenecks and optimize index usage.
Instructions
Return the execution plan for a SQL query to diagnose performance. Use this tool instead of running EXPLAIN directly through readQuery — it provides structured output via EXPLAIN QUERY PLAN.
<when_not_to_use>
Running actual queries → use readQuery or writeQuery
Checking table structure → use getTableSchema </when_not_to_use>
<what_it_returns> A JSON array of EXPLAIN QUERY PLAN rows showing how SQLite will scan tables, use indexes, and order operations. </what_it_returns>
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | The SQL query to explain. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| rows | Yes | Result rows, each a JSON object keyed by a column name. |