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 describe 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:
  • MySQL
  • PostgreSQL
  • Redis
  • MongoDB
  • PolarDB
Note MySQL, PostgreSQL, Redis, and MongoDB databases can be Alibaba Cloud databases or self-managed databases.

View slow query logs of a single database 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 statistics of slow query logs within 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 SQL Details: displays 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 analysis of slow query logs of top 10 instances on the Global Slow Log Trend page.

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.