analyze_query
Analyze MySQL query execution plans to identify performance bottlenecks, index usage, and optimization opportunities using EXPLAIN and EXPLAIN ANALYZE.
Instructions
Analyze a MySQL query's execution plan using EXPLAIN.
Provides detailed analysis of:
Query execution plan with access types
Index usage and potential missing indexes
Join types and optimization opportunities
Rows examined estimates
Key usage and key length
Supports EXPLAIN FORMAT=JSON for MySQL 5.6+ for detailed cost analysis. Use EXPLAIN ANALYZE (MySQL 8.0.18+) for actual execution statistics.
WARNING: With analyze=true, the query is actually executed!
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | The SQL query to analyze | |
| analyze | No | Use EXPLAIN ANALYZE to get actual execution stats (MySQL 8.0.18+) | |
| format | No | Output format for the execution plan | json |