Slow Query Logs
This section describes how to analyze slow query logs in a specified period. Slow Query Log displays a chart of SQL statements that are taking too long to execute and allows you to sort slow SQL statements by multiple dimensions, such as by user, host, or SQL template. It helps you quickly identify bottlenecks and improve instance performance.
Usage Notes
To use the slow query log function, you need to toggle on Collect Slow Query Logs. Then DAS will store slow query logs for analysis.
Viewing slow query logs
- 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.
- In the upper right corner of the Instance List page, search for instances by engine type, instance name, or instance IP.
- Locate the box containing your target instance and click Details.
- Choose SQL > Slow Query Logs.
- Select a time range and view trends, statistics, and details of the slow query logs generated within the time range.
- Log trends
In the trends graph, you can hover your mouse at any point in time to view slow query logs or CPU usage.
Above the chart, you can switch to another instance or node to view slow queries by instance or by node.
- Details
View slow query log details in the lower part of the Slow Query Logs area. The details include the SQL statement, execution time, database name, client, user, execution duration, lock wait duration, and scanned and returned rows.
Click Export to export slow query log details to a specific OBS bucket. After the details are exported, you can click Export History to view export records. You can also download the details to your local PC.
Locate the SQL template you want to diagnose and click Diagnose in the Operation column.
- Slow query log statistics
Click Sample in the Operation column to view the sample of the SQL statement template.
On the Statistics page, click Export to export slow query logs to a specific OBS bucket. Then you can click Export History to view export records. You can also download the exported slow query logs to your local PC.
- Log trends
Slow Query Log Storage and Archiving
- Slow query log storage
After Collect Slow Query Logs is enabled, SQL text content will be stored in OBS for analysis.
- Log archiving
Slow query logs are automatically archived every three minutes. Alternatively, you can click Generate Latest Log File and then view the latest statistics.
Slow query logs generated in the last 10 days are archived.
You can also download archived slow query logs to your local PC.
Deleting Slow Query Logs
On the Slow Query Logs tab page, you can click Delete All or Delete to delete all slow query logs or some slow query logs generated in a specific period.
Deleted slow query logs cannot be recovered. Exercise caution when performing this operation.
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