AnalyticDB for MySQL provides the SQL diagnostics feature to separately collect statistics for SQL query information at the query, stage, and operator levels, use the statistics to diagnose issues, and then provide optimization suggestions. This topic describes how to view the properties of a specific query and diagnosis results at each level in the AnalyticDB for MySQL console.

View query properties

  1. Go to the SQL Diagnostics tab. For more information, see Go to the SQL Diagnostics tab.
  2. In the upper-right corner of the SQL Diagnostics tab, select the overall search condition based on your business needs. For example, select Last 5 Minutes and Top 100 Most Time-consuming Queries.
  3. In the search result chart, use one of the following methods to go to the query details page:
    • Method 1

      In the Query Monitoring Information section, each colored bar in the trend chart represents one SQL query. Move the pointer over the colored bar corresponding to a specific query to view details such as the start or end time. Click Details to go to the query details page.

      1
    • Method 2

      On the Queries tab, click Diagnose in the Actions column corresponding to a specific query to go to the query details page.

      1
  4. In the Query Properties section, view the execution status of a specific query statement, such as Scanned Data, Returned Data, and Peak Memory.

    In the upper-right corner of the page, click Back to go to the query monitoring page to view other query-related information.

    1

View diagnosis results

  1. Repeat the steps in View query properties to go to the query details page.
  2. On the query details page, click the Execution Plan tab to view the hierarchy chart of the execution plan for a specific query. Use the hierarchy chart to view diagnosis results at the query, stage, and operator levels.
    • View query-level diagnosis results
      On the right side of the hierarchy chart, click the Query-level Diagnostic Results tab to view the details of the query-level diagnosis results. For more information, see Query-level diagnosis results. 2
    • View stage-level diagnosis results
      Click a stage such as Stage[4] in the hierarchy chart to view the details in the Diagnostic Results section of the corresponding stage. For more information, see Stage-level diagnostic results. 3
    • View operator-level diagnosis results
      1. Move the pointer over the stage that you want to view and click View Stage Plans to go to the details page. 3
      2. On the details page, click an operator such as TableScan[3] in the hierarchy chart to view the details in the Diagnostic Results section of the corresponding operator. For more information, see Operator-level diagnosis results. 1