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
- Go to the SQL Diagnostics tab. For more information, see Go to the SQL Diagnostics tab.
- 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.
- In the search result chart, use one of the following methods to go to the query details
- 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.
- Method 2
On the SQL Queries tab, click Diagnose in the Actions column corresponding to a specific query to go to the query details page.
- Method 1
- 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.
View diagnosis results
- Repeat the steps in View query properties to go to the query details page.
- 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 resultsOn 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.
- View stage-level diagnosis resultsClick a stage such as Stage 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.
- View operator-level diagnosis results
- Move the pointer over the stage that you want to view and click View Stage Plans to go to the details page.
- On the details page, click an operator such as TableScan 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.
- View query-level diagnosis results