Manage SQL queries

更新时间:
复制 MD 格式

Monitor slow SQL queries and manage running queries in ApsaraDB for ClickHouse to troubleshoot performance issues and maintain cluster health.

Background

Analyzing raw query logs requires installing clients, writing SQL, and manually sorting results with no easy way to visualize trends. ApsaraDB for ClickHouse provides a graphical interface for query logs that lets you search by key dimensions, perform statistical analysis on slow SQL queries, and analyze and summarize log data to identify and resolve performance issues.

Monitor slow SQL queries

The console displays statistical trends and details for slow queries within a specified time range.

  1. Log on to the ApsaraDB for ClickHouse console.

  2. In the upper-left corner, select the region of your cluster.

  3. On the Clusters page, click the Instance list tab. Then, click the target cluster's ID.

  4. In the left-side navigation pane, click Query Management.

  5. On the Query Management page, click the Slow Queries tab.

  6. Set the execution time threshold for slow queries. The default threshold is 3,000 ms.

    Note

    Minimum threshold: 500 ms.

  7. Select Slow SQL Trend or Slow SQL Details from the drop-down list, then apply a time filter to view trends or details.

    Click the image.png icon in the upper-right corner to export the filtered data.

Manage running SQL queries

ApsaraDB for ClickHouse lets you view and terminate running SQL queries in real time to free cluster resources.

  1. Log on to the ApsaraDB for ClickHouse console with your Alibaba Cloud account.

  2. In the upper-left corner, select the region of the target cluster.

  3. On the Clusters page, click the Instance list tab, and then click the ID of the target cluster.

  4. In the left-side navigation pane, click Query Management.

  5. On the Query Management page, click the Running Queries tab.

  6. Filter queries by User, SQL Keywords, or Initial Query ID.

    Note

    Without filters, all running queries are displayed.

  7. When the cluster fails or resource usage reaches the alert threshold, select the queries to terminate and click Terminate Selected Queries or Terminate All Queries.

Related tasks