This topic describes how to use the Database Autonomy Service (DAS) console to enable, use, and disable the feature of slow query log analysis for MongoDB instances.
To manage multiple database instances, you can use the feature of the global slow query log trend. This feature allows you to find the most frequently executed slow SQL statement and the instance where the number of the executed slow SQL statements is the largest.
You remain logged on to the DAS console.
DAS is connected to ApsaraDB for MongoDB instances, user-created MongoDB instances, or MongoDB instances that run on other clouds. Your DAS account is granted the required permissions.
By default, the feature of slow query log analysis is disabled. To enable the feature, follow these steps:
In the left-side navigation pane, click Instance Monitoring. On the page that appears, find the target database instance and check whether the instance is in the Accessed state. If the instance is in the Accessed state, move on to the next step.
Click the ID of the target instance. In the left-side navigation pane of the page that appears, click Slow Logs.
On the page that appears, click Enable Slow Log Analysis.
After about half an hour, you can view the general trends and the statistics of slow query logs.
By default, the Slow Log Trend section shows the number of slow SQL statements based on an interval of 15 minutes.
You can click a dot in the chart to view the slow query log details that are collected at the specific time.
The feature of slow query log analysis shows the slow query statistics and provides an easy method for you to find the most frequently executed slow SQL statement and the most time-consuming slow SQL statement. You can also find the slow query log where the SQL requests scan the largest average number of rows.
You can click Sample in the Actions column to view the request details, including the slow query log information, the username, and the client IP address.
In the left-side navigation pane of the DAS console, find the Request Analysis option, and click Slow Logs. On the page that appears, you can view the slow query log trends of all the connected database instances.