get_statements_with_sorting
Identify MySQL queries performing sorting operations to optimize database performance. Detects file sorts, memory sorts, and sort merge passes for index tuning and buffer size adjustments.
Instructions
Get statements that perform sorting operations.
Identifies queries with:
File sorts (on disk)
Memory sorts
Sort merge passes
High file sort ratios indicate need for index optimization or sort_buffer_size increase.
Note: This tool excludes queries against MySQL system schemas (mysql, information_schema, performance_schema, sys) to focus on user/application query analysis.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Maximum statements to return | |
| file_sorts_only | No | Only show statements with file sorts |
Input Schema (JSON Schema)
{
"properties": {
"file_sorts_only": {
"default": false,
"description": "Only show statements with file sorts",
"type": "boolean"
},
"limit": {
"default": 25,
"description": "Maximum statements to return",
"type": "integer"
}
},
"required": [],
"type": "object"
}