Database Autonomy Service (DAS) allows you to analyze slow query logs of ApsaraDB for MongoDB (MongoDB) instances. You can locate, analyze, diagnose, and track slow query logs. This helps you create indexes and improve the resource utilization of your instance.

Prerequisites

Background information

The slow query log analysis feature provides statistics about slow query logs. This helps you identify the most frequently executed slow SQL statement, the most time-consuming slow SQL statement, and the slow query statement that scans the largest average number of rows.

Procedure

  1. In the left-side navigation pane, choose Request Analysis > Slow Logs.
    mongo
    Note By default, the Slow Log Trend chart shows slow query logs within the latest 15 minutes. You can specify the time range and click Search to view slow query logs. The maximum time range is one day.
  2. View the details of slow query logs by using one of the following methods:
    • Method 1:
      1. Click the Slow Log Details tab under the Slow Log Trend chart.
      2. On the Slow Log Details tab, select the database that you want to query.
        Note If the request content is hidden, you can move the pointer over the request content and view the full request content in the window that appears.
    • Method 2:
      1. In the Slow Log Trend chart, click the point in time at which a slow query log is generated. On the Slow Log Statistics tab, view the details of the slow query log.
      2. On the Slow Log Statistics tab, click Sample in the Actions column. In the Slow Log Sample dialog box, view the details of the slow query log.
        Note If the request content is hidden, you can move the pointer over the request content and view the full request content in the window that appears.

Export slow query logs

On the Slow Log Statistics tab, click Export Slow Log and save the slow query logs to your on-premises machine.

Global trends of slow query logs

In the left-side navigation pane, choose Request Analysis > Slow Logs. On the page that appears, view the trends of slow query logs in all the database instances that are connected to DAS.