You can view the slow query logs of a database in the console and optimize the database accordingly by analyzing slow query logs.
A replica set instance with more than three nodes or a sharded cluster instance is used.
The retention period for slow logs is 72 hours.
- Log on to the ApsaraDB for MongoDB console.
- In the upper-left corner of the page, select the resource group and the region of the target instance.
- In the left-side navigation pane, click Replica Set Instances or Sharded Cluster Instances based on the instance type.
- Find the target instance and click its ID.
- In the left-side navigation pane, choose .
- View slow query logs based on instance types:
- Replica set instances: You can select the database name and time range to query the corresponding slow query logs.
- Sharded cluster instances: You can select the database name, shard node ID and time range to view the corresponding slow query logs.