SQL Diagnosis
This function enables you to diagnose SQL statements and obtain optimization suggestions.
Usage Notes
- Only SELECT, INSERT, UPDATE, and DELETE statements can be diagnosed. An INSERT statement must contain a SELECT clause.
- SQL diagnosis history is stored on the DAS server only. If you delete SQL diagnosis history on the console, it will be also deleted from the DAS server.
- Well-formatted SQL statements are much easier to read. Only line breaks will be added, and there are no logic and semantic changes.
- All SQL statements in the SQL window will be formatted. You cannot format only one of them.
Procedure
- Click
in the upper left corner and select a region and project.
- Click
in the upper left corner, and under Databases, click Data Admin Service.
- In the navigation pane, choose Intelligent O&M > Instance List.
- In the upper right corner of the Instance List page, search for instances by engine type, instance name, or instance IP address.
- Locate the target instance and click Details.
- Choose SQL > SQL Diagnosis. On the displayed dialog box, perform the following operations:
- Diagnosing SQL Statements
On the SQL Diagnosis tab page, select the database where you want to diagnose a SQL statement, enter a SQL statement, and click Diagnose. The diagnosis result page is displayed. You can optimize the SQL statement based on the diagnosis result.
- Executing SQL Statements
Select the target database, enter a SQL statement, and click Execute. The system executes the statement and displays a result set.
- Formatting SQL Statements
Select the target database, enter SQL statements, and click Format. The system formats all the SQL statements.
- Viewing the Execution Plan
Select the target database, enter SQL statements, and click View Execution Plan. The system executes all the SQL statements in sequence.
- Diagnosing SQL Statements
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.