Database Autonomy Service (DAS) provides the log analysis feature for slow queries. You can use this feature to view the trend, statistics, and details of slow queries.to identity, analyze, and track slow query logs. This helps you create indexes and improve the resource utilization of your instance.

Prerequisites

A replica set instance or a sharded cluster instance is created in MongoDB.

Procedure

  1. Log on to the DAS console.
  2. In the left-side navigation pane, click Instance Monitoring.
  3. On the page that appears, click the ID of the database instance that you want to manage. The instance details page appears.
  4. In the left-side navigation pane, choose Request Analysis > Slow Logs.
  5. On the Slow Log Analysis tab, specify a time range and view the trends, statistics, and details of the slow queries within the time range.
    Note When you select a time range, the end time must be later than the start time, and the interval between the start time and the end time cannot exceed 24 hours. You can query slow query logs within a month.
    • You can click a time point in the trend chart and view the statistics and details of the slow queries at the time point.
      Note If the content of an SQL statement is not completely displayed due to length, you can move the pointer over the SQL statement and view the complete content.
    • On the Node List tab, view the number of slow queries on each node.
    • You can click Export Slow Log to download slow query logs.
    • On the Slow Log Statistics tab, click Sample in the Actions column corresponding to the SQL template to view the slow query log sample of the SQL template.

View the global trends of slow query logs

  1. Log on to the DAS console.
  2. In the left-side navigation pane, choose Request Analysis > Slow Logs. Select MongoDB, and then view the global trends of slow query logs and top instance statistics.
    Note When you select a time range, the end time must be later than the start time, and the interval between the start time and the end time cannot exceed 7 days. You can query slow query logs within 14 days.
    Global slow query logs