AnalyticDB for MySQL clusters provide the SQL diagnostics feature to search for SQL queries that meet a variety of conditions (such as slow queries) and show the search results as a chart. You can also download and save the search results to your computer. This topic describes how to use the query monitoring charts and lists in SQL diagnostics.

Query monitoring charts

In the Query Monitoring Information section of the SQL Diagnostics tab, you can view the execution duration of queries that executed within a specified time range to quickly find time-consuming queries. 1
Note
  • Each colored bar in the chart represents a single query.
  • Different colors are used only to distinguish different queries. The longer the colored bar, the longer the execution time consumed by the corresponding query.
  • Move the pointer over the colored bar corresponding to a query to view details such as the start time, end time, and amount of scanned data. Click Details to go to the details page of a query and view Query Properties, SQL Statement, and Execution Plan. For more information, see Use execution plans to analyze queries.
  • A maximum of 10,000 queries can be displayed in the Query Monitoring Information section. The specific information of each query is displayed in the Queries section below the monitoring chart. For more information, see Query lists.
  • Only general search results of queries are displayed in the Query Monitoring Information section. For example, you can search for queries that meet the Last 5 Minutes and Top 100 Most Time-consuming Queries conditions. Advanced search in the upper-right corner of the Queries tab does not affect the results displayed in the Query Monitoring Information section. For more information, see Search methods.

Query lists

Compared with query monitoring charts, query lists can display more information of SQL queries, such as specific SQL statements and source addresses. You can further filter search results by using the advanced search feature in the upper-right corner of the Queries tab. This helps you find faulty queries more accurately. Advanced search results do not affect the results displayed in the query monitoring charts. 2

The following table describes the operations that you can perform on the Queries tab.

Operation Description
Download Click Download to save the query results to an Excel file. The file is automatically stored in the Last 5 Downloads drop-down list.
Note A maximum of 100,000 records can be downloaded at a time.
Last 5 Downloads Select the query result that you want to download from the Last 5 Downloads drop-down list to complete the download.
Advanced Search Click Show Advanced Search and select a search dimension. For example, you can select the Resource Group or Source Address dimension to further filter the query results for Query Monitoring Information.
Diagnose Click Diagnose in the Actions column to go to the details page of a query and view Query Properties, SQL Statement, and Execution Plan. For more information, see Use execution plans to analyze queries.
Note
  • The advanced search feature in the upper-right corner of the Queries tab can be used to further filter general search results. Valid values of the filter conditions in the advanced search section are existing values in the general search results instead of all values in the current AnalyticDB for MySQL cluster. For more information, see Search methods.
  • If you select Running Queries for general search, only details of SQL queries that took more than 10 seconds are displayed in the search result, and the Resource Consumption Ranking column is displayed on the Queries tab. A smaller value in the Resource Consumption Ranking column indicates that more CPU and memory resources are consumed by the corresponding query.
  • A maximum of 5,120 characters can be displayed in the SQL column on the Queries tab. Additional characters are truncated if SQL statements exceed 5,120 characters in length. You can view complete SQL statements in the downloaded Excel file or on the SQL Statement tab of the details page of corresponding queries.