🔵 ByteHouse Brand Identity
"ByteHouse" — Volcano Engine cloud-native data warehouse, extremely fast, stable, secure, and easy to use
This Skill is based on ByteHouse MCP Server and provides complete slow query analysis and performance optimization capabilities
Description
ByteHouse slow query analysis and performance optimization tool.
Use this Skill when the following situations occur: (1) Need to identify and analyze slow queries (2) Need query performance optimization suggestions (3) Need to view query execution plans (4) Need to analyze query historical trends (5) User mentions "slow query", "query optimization", "performance analysis", "execution plan"
Prerequisites
- Python 3.8+
- uv (already installed in
/root/.local/bin/uv) - ByteHouse MCP Server Skill - This skill depends on the ByteHouse access capability provided by the
bytehouse-mcpskill
Dependencies
This skill depends on the bytehouse-mcp skill and uses the MCP Server it provides to access ByteHouse.
Ensure that the bytehouse-mcp skill is correctly configured and can be used normally.
📁 File Description
- SKILL.md - This file, the main skill document
- slow_query_analyzer.py - Main slow query analysis program
- README.md - Quick start guide
Configuration Information
ByteHouse Connection Configuration
This skill reuses the configuration of the bytehouse-mcp skill. Please ensure that the following has been configured in the bytehouse-mcp skill:
export BYTEHOUSE_HOST="<ByteHouse-host>"
export BYTEHOUSE_PORT="<ByteHouse-port>"
export BYTEHOUSE_USER="<ByteHouse-user>"
export BYTEHOUSE_PASSWORD="<ByteHouse-password>"
export BYTEHOUSE_SECURE="true"
export BYTEHOUSE_VERIFY="true"
🎯 Feature Characteristics
1. Slow Query Identification
- Get slow queries from the query_log table
- Sort by execution time
- Identify Top N slow queries
- Analyze slow query patterns
2. Query Performance Analysis
- Query execution time distribution
- Query type statistics
- Query frequency analysis
- Performance trend analysis
3. Execution Plan Analysis
- Obtain query execution plans
- Analyze execution plan nodes
- Identify performance bottlenecks
- Provide optimization suggestions
4. Optimization Suggestion Generation
- Index optimization suggestions
- Query rewrite suggestions
- Table engine suggestions
- Configuration parameter tuning
🚀 Quick Start
Method 1: Run slow query analysis
cd /root/.openclaw/workspace/skills/bytehouse-slow-query
# 先设置环境变量(复用bytehouse-mcp的配置)
export BYTEHOUSE_HOST="<ByteHouse-host>"
export BYTEHOUSE_PORT="<ByteHouse-port>"
export BYTEHOUSE_USER="<ByteHouse-user>"
export BYTEHOUSE_PASSWORD="<ByteHouse-password>"
export BYTEHOUSE_SECURE="true"
export BYTEHOUSE_VERIFY="true"
# 运行慢查询分析
uv run slow_query_analyzer.py
The analysis content includes:
- Top 20 slow queries
- Query performance statistics
- Execution time distribution
- Optimization suggestion generation
Output files (saved in the output/ directory):
slow_queries_{timestamp}.json- List of slow queriesquery_stats_{timestamp}.json- Query statistics reportoptimization_suggestions_{timestamp}.json- Optimization suggestions
💻 Slow Query Analysis Dimensions
Time Dimension Analysis
- By hour: Number of slow queries per hour
- By day: Daily slow query trends
- By week: Weekly slow query patterns
- By month: Monthly slow query statistics
Query Type Analysis
- SELECT Queries: Query statement analysis
- INSERT Queries: Write performance analysis
- UPDATE Queries: Update performance analysis
- DELETE Queries: Delete performance analysis
- DDL Queries: Create/alter table performance analysis
Performance Metrics
- Average Execution Time: Average duration of all queries
- P50 Execution Time: Median execution time
- P95 Execution Time: 95th percentile execution time
- P99 Execution Time: 99th percentile execution time
- Maximum Execution Time: Duration of the slowest query
📊 Slow Query Report Example
Slow Query List
{
"analysis_time": "2026-03-12T21:00:00",
"total_queries": 10000,
"slow_queries": 150,
"top_slow_queries": [
{
"query_id": "query-12345",
"query_text": "SELECT * FROM large_table WHERE ...",
"duration_ms": 15000,
"start_time": "2026-03-12T20:55:00",
"read_rows": 1000000,
"read_bytes": 104857600
}
]
}
📚 More Information
For detailed usage instructions, please refer to bytehouse-mcp skill
Last updated: 2026-03-12