This topic describes how to view the slow log details of an ApsaraDB RDS for MySQL instance.

Precautions

If more than 600 slow query log entries are generated within 1 minute on your RDS instance, some entries may be lost. To mitigate the loss of slow query log entries, you can Update the minor engine version of an ApsaraDB RDS for MySQL instance to 20191212.

View slow log details by using the ApsaraDB RDS console

  1. Visit the RDS instance list, select a region above, and click the target instance ID.
  2. In the left-side navigation pane, click Logs.
  3. Click the Slow Log Details tab and on the tab view the slow log details of your RDS instance.慢日志明细
    Note The Slow Log Details tab provides information such as Slow Log Collection Time, SQL Statement, Client IP Address, Database Name, and Query Duration (Seconds). The time in the Slow Log Collection Time column is the time when ApsaraDB RDS detects the slow SQL statement. It is not the time when the slow SQL statement is executed.

View slow log details by using commands

Note This operation is not supported if your RDS instance runs MySQL 5.5.
  1. Log on to your RDS instance by using Alibaba Cloud Data Management (DMS). For more information, see Use DMS to log on to an ApsaraDB RDS for MySQL instance.
  2. In the top navigation bar, choose SQL Operations > SQL Window.
  3. Run the following command to obtain the slow log details of your RDS instance:
    select * from mysql.slow_log