PolarDB for MySQL provides the slow SQL analysis feature. This feature allows you to view slow log trends and statistics. You can also obtain the diagnostic results and suggestions on how to fix slow SQL queries.
The service edition of your PolarDB for MySQL clusters is Cluster Edition or Archive Database. This feature is unavailable for Single Node. For more information about service editions, see Product editions.
View slow log trends and statistics
- Log on to the PolarDB console.
- In the upper-left corner of the console, select the region where the cluster is deployed.
- Find the cluster and click the cluster ID.
- In the left-side navigation pane, choose .
- In the Slow Log Trend section, use one of the following methods to view slow log trends:
Note By default, the slow log trend within the last 15 minutes is displayed.
- Click Last 15 Minutes, 30 Minutes, or 1 Hour to view the slow log trends within the last 15 minutes, the last 30 minutes, or the last hour.
- Specify the date range and click Search to view the slow log trend within at most 30 days. The interval between the end time and the start time must be within 24 hours.
- Optional:To view the slow log trend of a specific node, click the ID of the node in the Nodes section.
- In the Slow Log Trend section, click a time point in the line chart. Then, you can view the statistics
of the slow logs at the point in time on the Slow Log Statistics tab.
- To troubleshoot slow SQL queries, use one of the following methods:
- Click Sample in the Actions column of the slow SQL query to view the details of the slow SQL query.
- Click Optimize in the Actions column of the slow SQL query to view the diagnostic results and suggestions. Note You can also click Expert Service to purchase the expert service. The expert service provides value-added professional database services, such as emergency solutions, health diagnostics, performance optimization, security assurance, and data migration.
Export slow logs
Related API operations
|DescribeSlowLogRecords||Queries the details of slow logs for a PolarDB for MySQL cluster.|
|DescribeDBClusterAuditLogCollector||Queries whether SQL data collector is enabled for a PolarDB for MySQL cluster. The features of SQL data collector include audit logs and SQL Explorer.|
|ModifyDBClusterAuditLogCollector||Enables or disables SQL data collector for a PolarDB for MySQL cluster. The features of the SQL data collector include audit logs and SQL Explorer.|