text
| 1 | # Query Plan Reader |
| 2 | |
| 3 | The usual response to a slow query is to add an index to whatever column appears in |
| 4 | the WHERE clause, which sometimes helps and often does not. This skill reads the plan |
| 5 | properly: finds where time is actually spent, checks whether the planner's row |
| 6 | estimates match reality, and proposes the smallest change that addresses the real |
| 7 | cost rather than the obvious one. |
| 8 | |
| 9 | ## When to use |
| 10 | |
| 11 | - A query got slow and nobody knows why. |
| 12 | - Before adding an index, to check that it will be used. |
| 13 | - When the planner picks a bad plan and you need to know what it believes. |
| 14 | |
| 15 | ## Install |
| 16 | |
| 17 | ```bash |
| 18 | npx openagents-cli add openagents/sql-explain |
| 19 | ``` |
| 20 | |
| 21 | | Runtime | Installed to | |
| 22 | |---|---| |
| 23 | | `claude-code` | `.claude/skills/sql-explain/` | |
| 24 | | `cursor` | `.cursor/rules/sql-explain/` | |
| 25 | | `codex` | `.codex/skills/sql-explain/` | |
| 26 | | `openai-agents` | `agents/sql-explain/` | |
| 27 | | `generic` | `.openagents/sql-explain/` | |
| 28 | |
| 29 | ## What is in the package |
| 30 | |
| 31 | - `SKILL.md` - the procedure, from getting a real plan to verifying the fix. |
| 32 | - `plan-nodes.md` - what each common plan node means and when it is the problem. |
| 33 | |
| 34 | ## License |
| 35 | |
| 36 | MIT |
| 37 |