ch_slow_queries
Identifies slow ClickHouse queries and diagnoses root causes such as full scans, memory issues, and aggregation inefficiencies.
Instructions
Find slow queries with root cause diagnosis.
Scans system.query_log for queries exceeding the duration threshold, then generates a diagnosis for each:
Full scan detection (high read_rows without partition pruning)
Memory-intensive query detection
Aggregation optimization suggestions (use pre-aggregated tables)
Error detection
Args: hours: Look back period in hours (default: 24) min_duration_ms: Minimum query duration to report (default: 1000ms) limit: Maximum number of slow queries to return (default: 20)
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "ch_slow_queries"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| hours | No | ||
| min_duration_ms | No | ||
| limit | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |