All Products
Search
Document Center

ApsaraDB for MongoDB:Slow query logs

Last Updated:Oct 29, 2024

ApsaraDB for MongoDB allows you to identify, analyze, perform an diagnosis on, and track the slow query logs of an ApsaraDB for MongoDB instance so that you can create indexes to make better use of instance resources.

Prerequisites

  • The instance is a replica set instance or a sharded cluster instance.

  • If the instance was purchased between June 6, 2021 and November 25, 2021, the audit log feature is enabled and slow is selected in the Audit Log Filter Setting panel. For more information about how to enable the audit log feature, see Enable the audit log feature.

    Note

    If only slow is selected in the Audit Log Filter Setting panel, the audit log feature is provided free of charge.

Procedure

  1. Go to the Replica Set Instances or Sharded Cluster Instances page. In the top navigation bar, select the region in which the instance resides. Then, find the instance and click the ID of the instance.

  2. In the left-side navigation pane of the instance details page, choose CloudDBA > Slow Query Log Analysis.

    On the Slow Query Logs page, view information displayed in Slow Log Trend, Nodes, Slow Log Statistics, and Slow Log Details.

    Note

    For replica set instances, the Nodes section is not displayed.

    • Slow Log Trend: displays the trend chart of slow query logs within the last 15 minutes by default. The longest time range to query is the last 3 hours.

    • Nodes: displays the number of slow queries that are run on each node.

    • Slow Log Statistics: displays the statistics of slow query logs. The Slow Log Statistics tab includes the Total Executions, Avg Execution Duration (ms), Max Execution Duration (ms), Avg Returned Rows, and Max Returned Rows metrics.

    • Slow Log Details: displays the details of slow query logs. The Slow Log Details tab includes the Execution Finish Time, Database, Request Content, Client, and Execution Duration (ms) metrics.

    Note
    • On the Slow Log Statistics or Slow Log Details tab, you can click Export Slow Log to save the statistics or details to your computer.

    • By default, only operations whose execution duration exceeds 100 milliseconds are considered slow operations. You can configure the operationProfiling.slowOpThresholdMs parameter to modify the execution duration threshold. For more information, see Configure database parameters for an ApsaraDB for MongoDB instance.