get_slow_queries
Identify and analyze slow MySQL queries with execution statistics, table scan data, and performance metrics to optimize database performance.
Instructions
Retrieve slow queries from MySQL performance_schema.
Returns the top N slowest queries with detailed statistics:
Total execution time
Number of calls
Average execution time
Rows examined vs rows sent
Full table scans
Temporary tables usage
Requires performance_schema to be enabled (default in MySQL 5.6+). For older versions, use the slow query log instead.
Note: This tool excludes queries against MySQL system schemas (mysql, information_schema, performance_schema, sys) to focus on user/application query performance.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Maximum number of slow queries to return (default: 10) | |
| min_exec_time_ms | No | Minimum total execution time in milliseconds (default: 0) | |
| order_by | No | Column to order results by | total_time |
| schema_name | No | Filter by schema/database name (optional) |