If your ApsaraDB for ClickHouse cluster encounters performance issues or when you perform periodic maintenance, you can view slow SQL queries to troubleshoot the issues. This topic describes how to monitor slow SQL queries and manage running SQL queries in the ApsaraDB for ClickHouse console.
Background information
The process of writing raw query logs to tables is complex. You need to perform operations such as installing clients, writing SQL statements, and sorting results. The trend of slow SQL queries cannot be displayed in an intuitive manner. This results in high costs, poor usability, and low efficiency. ApsaraDB for ClickHouse displays query logs by using graphical interfaces. ApsaraDB for ClickHouse allows you to perform visual retrieval by key dimensions and analyze the statistics of slow SQL queries. You can summarize and analyze log data with only a few clicks. This helps you identify and handle issues.
Monitor slow SQL queries
You can collect statistics to display the trend of slow SQL queries and view the details of slow SQL queries over the specified time range in the console to monitor slow SQL queries.
Log on to the ApsaraDB for ClickHouse console.
In the top navigation bar, select the region where the cluster that you want to manage is deployed.
On the Clusters page, click the Default Instances tab, find the cluster that you want to manage, and then click the ID of the cluster.
In the left-side navigation pane, click Query Management.
On the Query Management page, click the Slow Queries tab.
Customize a runtime for slow SQL queries. By default, queries whose runtime exceeds 3,000 ms are considered slow SQL queries.
NoteThe minimum runtime for slow SQL queries is 500 ms.
You can select Slow SQL Trend or Slow SQL Details from the drop-down list and specify time-related filter conditions to view the trend or details of slow SQL queries.
Click to export the data of filtered slow SQL queries.
Manage running SQL queries
The Running Queries tab of ApsaraDB for ClickHouse displays running SQL queries in real time. You can view the details of running SQL queries and terminate selected SQL queries to temporarily release resources.
Log on to the ApsaraDB for ClickHouse console with your Alibaba Cloud account.
In the top navigation bar, select the region where the cluster that you want to manage is deployed.
On the Clusters page, click the Default Instances tab, find the cluster that you want to manage, and then click the ID of the cluster.
In the left-side navigation pane, click Query Management.
On the Query Management page, click the Running Queries tab.
To filter query results, select , , or from the drop-down list.
NoteIf you do not configure a filter condition, all running SQL queries are displayed by default.
If the cluster fails or the resource usage reaches the threshold, select the slow SQL queries that cause the issue, and then click Terminate Selected Queries to terminate the selected query requests. You can also click Terminate All Queries to terminate all query requests.