After you view the basic information about SQL, you can click the link in the SQL text column to go to the SQL details page.
SQL text
In the SQL text section:
Select Table Structure to view the corresponding table structure information.
Click View samples to view the complete SQL statement.
Optimization suggestions
Note
This section is not displayed if there are no optimization suggestions.
In the Optimization suggestions section, view all issues and corresponding optimization suggestions for the SQL statement within the diagnostic time range. At present, the system provides two types of optimization suggestions:
Plan recommendation
The system analyzes SQL execution plans of the last week. If a plan significantly outperforms other plans of the same type in CPU time (whether local or distributed plans), the system recommends that you pay attention to this plan. When a plan recommendation is available, we recommend that you analyze the differences between the recommended plan and the existing execution plan, confirm that no DDL changes are involved, and then consider binding the plan. After binding, closely monitor the optimization effect. If no optimization effect is achieved, roll back the operation promptly.
The specific plan recommendation rules are as follows:
Plan recommendation evaluates candidate plans based on the CPU time of the latest execution plan. When the CPU time of the latest execution plan is small, only candidate plans that significantly outperform the latest plan are recommended. When the CPU time of the latest execution plan is large, a candidate plan only needs to slightly outperform the latest plan to be recommended.
CPU time of the latest planCPU time of the candidate plan[0, 1) ms 1/10 of the CPU time of the latest plan [1, 10) ms 1/5 of the CPU time of the latest plan [10, 100) ms 1/2 of the CPU time of the latest plan [100, 1000) ms 2/3 of the CPU time of the latest plan [1000, +∞) ms 5/6 of the CPU time of the latest plan Index recommendation
The specific index recommendation rules are as follows:
Place equi-join columns at the beginning, in any order.
If there is a range query, place the most selective range query column after the equi-join columns.
If there is no range query, when the sorting condition can be eliminated, place the sorting columns after the equi-join columns.
Place other columns in the predicates after the index to form a half-width index.
Place other columns in Select after the index to construct a covering index.
If a covering index contains no more than 8 columns, a covering index is recommended. Otherwise, a half-width index is recommended.
Index recommendation is performed only when CPU time exceeds 10 ms or response time exceeds 20 ms.
SQL diagnostics details
Note
This section is not displayed if there are no SQL diagnostics details.
In the SQL Diagnostics Details section, view the number of times issues of the same type occurred within the diagnostic time range and the details of the most recent diagnosis, including the time range, execution count, CPU time, and last execution time. Click the triangle arrow to view more details, such as the diagnostic basis and troubleshooting suggestions.
SQL sampling details
Note
SQL sampling details are displayed only on the Slow SQL details page. They are not displayed on details pages of other SQL types.
In the SQL Sampling Details section:
View the specific sampling information of the current SQL.
Click the icon in the upper-right corner of the list to download the SQL sampling details table.
Click the icon in the upper-right corner of the list. In the Manage Columns window that appears, you can view more metrics.
Physical execution plan
On the Physical Execution Plan tab, view the execution plan details and bind an execution plan.
Click the Plan Hash text to view the corresponding physical execution plan details.
View the application process of operators in the execution steps and the server execution plan.
Note
You can click View AI Insight to view the SQL operator interpretation provided by AI and the physical execution plan summary. The AI insights are for reference only.
Hover the pointer over the object name in the execution plan to view the table structure or DDL index information. If the object name is a table, you can view the table structure. If the object name is an index, you can view DDL index information.
Click Custom Time and select Past 1 Hour, Past 12 Hours, or Past 1 Day from the drop-down list to quickly filter the query time range. You can also customize the query time range, but you can view physical execution plans only for the last 15 days.
Click Binding History in Last 30 Days to view the binding records of physical execution plans in the last 30 days.
Click Refresh Plan Cache. After you confirm the operation, the execution plan cache for this SQL under the tenant is cleared. The next time you execute this SQL, the system regenerates the execution plan.
Click Bind. After you confirm the operation, the SQL is forced to run according to this execution plan. If the execution plan is bound, Bound is displayed.
SQL execution history
On the SQL Execution History tab, view the historical execution information of the current SQL statement, including Execution Time (UTC+8), Total Executions, and Total DB Time (ms).
Click Custom Time and select Past 1 Hour, Past 12 Hours, or Past 1 Day from the drop-down list to quickly filter the query time range. You can also customize the time range. Note the following limitations:
You can view SQL execution history only for the last 15 days.
The minimum time range is as follows:
For data within 3 days: The selected time range must be at least 1 minute.
For data from 3 to 7 days: The selected time range must be at least 5 minutes.
For data beyond 7 days: The selected time range must be at least 20 minutes.
Click the icon in the upper-right corner. In the Manage Columns window that appears, you can view more metrics.
Click the icon in the upper-right corner to download the SQL execution history list.
Table information
On the Table Information tab, view index-related information and perform operations such as index binding. If an index is bound, Bound is displayed in the Actions column. You can also view table statistics.
Advanced settings
On the Advanced Settings tab, you can perform the following operations:
Throttling settings
In the Throttling Settings section, click Set Throttling.
Enter the value for Maximum Concurrent Requests and click OK.
In the dialog box that appears, click OK.
Outline settings
In the Outline Settings section, click Set Outline.
Enter the outline and click OK.
In the dialog box that appears, click OK.
