After viewing the basic information about SQL in real-time diagnostics, you can click the link in the SQL text column to go to the SQL details page.
SQL text
In the SQL text section:
You can view the table schema by selecting Table Structure.
You can click View samples to view the complete SQL statement.
Optimization suggestions
Note
This section will not be 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
Analyze the SQL execution plans of the last 7 days. If a plan significantly outperforms other similar plans in CPU time, whether they are local or distributed plans, the system recommends that you pay attention to this plan. If any 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, promptly roll back the operation.
The specific plan recommendation rules are as follows:
Plan recommendation evaluates the candidate plans based on the CPU time of the latest execution plan. When the CPU time of the latest execution plan is small, only those 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 plan (ms) CPU time of the candidate plan (ms) [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:
Equi join columns are placed at the beginning, in any order.
For range queries, the most selective range query columns are placed after the equi join columns.
For non-range queries, if the sorting condition can be eliminated, the sorting columns are placed after the equi join columns.
Other columns in the predicates are placed after the index to form a half-width index.
Other columns in the Select statement are placed 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.
No index is recommended when the CPU time is less than 10 ms or the response time is less than 20 ms.
SQL diagnostics details
Note
This section does not appear if no SQL diagnostics details are available.
In the SQL Diagnostics Details section, you can view the number of times this type of issue occurred within the diagnostic time range, as well as the details of the most recent diagnostic, 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 pops up, 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 filter execution plans within the last 1 hour, 12 hours, or 24 hours. You can also customize the query time range, but you can only view physical execution plans generated in 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 to clear the execution plan cache for this SQL statement under the tenant. The next time when you execute this SQL statement, the system will regenerate the execution plan.
Click Bind to bind the execution plan to this SQL statement. If the execution plan is bound, it will be displayed as Bound.
SQL execution history
On the SQL Execution History tab, view the historical execution information of the current SQL statement, including SQL text, Execution Time (UTC+8), Total Executions, and Total DB Time (ms).
Click Custom Time to filter the query time range. You can select Past 1 Hour, Past 12 Hours, or Past 1 Day from the drop-down list. 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 to query more metrics in the Manage Columns window.Click the
icon to download the SQL execution history list.
Table information
On the Table Information tab, you can 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:
Limit flow 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.
Keyword limit flow settings
In the Keyword Throttling Settings section, click Set Keyword Throttling.
In the refreshed page, click Throttling Keywords. In the drop-down list, select Settings.
In the Set Throttling Keywords dialog box, enter the throttling keyword in the corresponding field, and click OK.
Note
You do not need to specify all keywords. Specify only the keywords that are required. If you enter a value that contains spaces in the input field, enclose the value in double or single quotation marks.
Set the value of Maximum Concurrency of Keywords and click OK.
Note
The maximum concurrency value specified for a keyword takes effect only on that keyword.
In the dialog box that appears, click OK.
Outline settings
In the Outline Settings section, click Set Outline.
Enter Outline and click OK.
In the dialog box that appears, click OK.