analyze_query
Analyze SQL query execution plans and performance metrics using EXPLAIN ANALYZE to identify optimization opportunities, timing breakdowns, and buffer usage statistics.
Instructions
Analyze a SQL query's execution plan and performance characteristics.
Uses EXPLAIN ANALYZE to execute the query and capture detailed timing information. Provides analysis of:
Execution plan with actual vs estimated rows
Timing breakdown by operation
Buffer usage and I/O statistics
Potential performance issues and recommendations
WARNING: This actually executes the query! For SELECT queries this is safe, but be careful with INSERT/UPDATE/DELETE - use analyze_only=false for those.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | The SQL query to analyze | |
| analyze | No | Whether to actually execute the query (EXPLAIN ANALYZE vs EXPLAIN) | |
| buffers | No | Include buffer usage statistics | |
| verbose | No | Include verbose output with additional details | |
| format | No | Output format for the execution plan | json |
| settings | No | Include information about configuration parameters |