Fixing Slow SQL Queries
You can use DAS to monitor databases and identify and fix slow SQL queries to improve database performance.
Solution
Viewing and Optimizing Slow SQL Statements of a Single Instance
- Log in to the DAS console.
- 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.
Alternatively, on the Overview page, click Go to Intelligent O&M.
- In the upper right corner of the instance list, filter instances by engine, name, or IP address. Click Details to go to the Dashboard tab page.
Figure 1 Intelligent O&M
- Choose SQL > Slow Query Logs.
Select a time range and view trends, details, and statistics of the slow query logs. You can click Export to export a slow query log to your local PC.
Figure 2 Slow Query Logs
- In the Details area, click Concurrency Control in the Operation column. In the displayed dialog box, create a concurrency control rule for the current SQL statement by configuring parameters, including Max. Concurrency to ensure stability of core services. For details, see SQL Statement Concurrency Control.
Figure 3 Concurrency control
- In the Details area, click Diagnose in the Operation column to diagnose the current SQL statement and view index or statement optimization suggestions and an execution plan. You can paste optimized SQL statement to the database client or DAS for execution. For details, see SQL Diagnosis.
Figure 4 Diagnosis
Viewing Slow SQL Queries on All Instances
- Log in to the DAS console.
- 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 > Dashboard.
Select a time range and view the number of slow SQL queries of the top 10 to 30 instances in the current region. You can also view information about the slow SQL template of an instance.
Figure 5 Overview of slow SQL queries
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot