- Add 60 new agents across all 10 categories (75 -> 135) - Add 95 new plugins with command files (25 -> 120) - Update all agents to use model: opus - Update README with complete plugin/agent tables - Update marketplace.json with all 120 plugins
1.4 KiB
1.4 KiB
/explain-plan - Explain Query Execution Plan
Generate and interpret a SQL query execution plan in plain language.
Steps
- Take the SQL query from the user input
- Determine the database engine (PostgreSQL, MySQL, SQLite, SQL Server)
- Run EXPLAIN or EXPLAIN ANALYZE with the appropriate syntax for the engine
- Parse the execution plan output into structured components
- Identify each operation: Sequential Scan, Index Scan, Nested Loop, Hash Join, Sort
- Explain each step in plain language: what table is read, how it is filtered
- Highlight expensive operations: full table scans, large sort operations, hash joins
- Calculate the cost percentage of each step relative to total query cost
- Identify the critical path (most expensive sequence of operations)
- Suggest specific improvements for the most costly operations
- Estimate memory usage and temporary disk usage from the plan
- Present the explanation as a step-by-step narrative
Rules
- Translate database-specific terminology into plain English
- Highlight operations that scan more than 1000 rows without an index
- Show estimated vs actual rows to identify cardinality estimation errors
- Explain the difference between estimated cost and actual execution time
- Identify parallel query opportunities if the database supports them
- Note when the planner chose a suboptimal plan due to stale statistics
- Recommend ANALYZE/VACUUM if statistics appear outdated