This topic describes how to view the slow query log details for an ApsaraDB RDS for MySQL instance. It also covers common issues, including SQL logging criteria, statement truncation, timestamp discrepancies, and differences in log entry counts.
Overview
The slow query log feature for ApsaraDB RDS for MySQL is enabled by default. For more information, see Collection policy for ApsaraDB RDS for MySQL slow query logs. To view other types of logs, see View error logs and slow query logs.
Usage notes
-
If an instance generates more than 600 slow query log entries within one minute, some entries may be lost. You can mitigate this issue by upgrading the minor engine version to 20191212 or later.
-
If an SQL statement exceeds 8,192 bytes, the slow query log truncates the statement. The same limitation applies to SQL Explorer. You cannot change this 8,192-byte truncation limit. To get the complete SQL statement, retrieve the full request from your application.
Query logs on the Slow Log Analysis page
Log on to the ApsaraDB RDS console and go to the Instances page. In the top navigation bar, select the region in which the RDS instance resides. Then, find the RDS instance and click the instance ID.
-
In the left-side navigation pane, choose Autonomy Services > Slow Query Logs.
-
On the Slow Log Analysis tab, select a time range to view the corresponding slow query log statistics and details.
NoteYou can also go to the Logs page from the instance details page and view slow query log details on the Slow Log Details tab.
Important-
The slow query log details include information such as SQL statement, access source, database, and execution time. The collection time for a slow query log is recorded differently based on the minor engine version. In earlier versions, this timestamp indicated the query's end time. Starting from minor engine version 20211231 (for MySQL 5.7.35) and 20220530 (for MySQL 8.0.25), the timestamp indicates the query's start time.
-
To export slow query log details, see Slow Log Analysis.
-