Database Autonomy Service (DAS) provides the slow query log analysis feature. You can view the trends, execution, and optimization suggestions of slow query logs in the DAS console. This topic describes how to analyze slow query logs. ApsaraDB RDS for MySQL databases are used in the example.

Prerequisites

A database instance is connected to DAS. For more information, see Access an Alibaba Cloud database instance and Access other self-managed database instances. The database instance can run the following engines:
  • RDS MySQL
  • RDS PostgreSQL
  • PolarDB MySQL
  • PolarDB PostgreSQL
  • PolarDB-O
  • Redis
  • MongoDB

View the slow query logs of a single instance

  1. Log on to the DAS console.
  2. In the left-side navigation pane, click Instance Monitoring.
  3. Find the database instance that you want to view. Choose Performance > Slow Logs in the Actions column to go to the slow query log details page.

    The slow query log details page contains the following sections:

    • Slow Log Trend: displays the slow query log trend of the database instance.
    • Slow Log Statistics: displays the statistics of slow query logs in a specified time range. You can also optimize SQL statements.
      Note The slow query log optimization feature is available only for ApsaraDB RDS for MySQL databases and self-managed MySQL databases.
    • Slow Log Details: displays the execution details of slow query logs.

View the global trend of slow query logs

If you have multiple database instances, you can view the global trend and the analysis of slow query logs of the top 10 instances in the Global Slow Log Trend section.

Note The global trend feature for slow query logs is available only for self-managed MongoDB, MySQL, and Redis databases, ApsaraDB RDS for MySQL databases, and ApsaraDB for Redis databases.
  1. Log on to the DAS console.
  2. In the left-side navigation pane, choose Request Analysis > Slow Logs to view Global Slow Log Trend and Top Instance Statistics.