Database Autonomy Service (DAS) analyzes slow query logs for PolarDB for MySQL instances, collecting statistics on SQL statements whose execution duration exceeds the configured threshold. Use this feature to:
Identify when slowdowns occurred using trend charts and event distribution
Find the most impactful SQL patterns using per-template aggregation with user distribution, client distribution, and metric correlations
Diagnose root causes and apply optimization suggestions with expected improvement estimates
Limit runaway queries immediately using one-click throttling while you work on a fix
Prerequisites
Before you begin, ensure that you have:
A PolarDB for MySQL instance
PolarDB for MySQL Enterprise Edition Single Node Edition is not supported.
Background information
Slow query logs are generated by the database kernel. Relevant parameters and thresholds vary based on the database engine. For more information, see the corresponding official documentation.
View slow query logs
Log on to the DAS console.
In the left-side navigation pane, choose Intelligent O&M Center > Instance Monitoring.
Find the instance you want to manage and click its instance ID.
In the left-side navigation pane, choose Request Analysis > Slow Logs.
On the Slow Log Analysis tab, set a time range.
NoteThe end time must be later than the start time. The interval cannot exceed 24 hours. You can query logs from the previous month.
Review the data in the four sections described below.
Slow Query Log Trends
The trend chart shows slow query counts over time. Use this view to pinpoint when a performance issue occurred. Click any point in the chart to see the statistics and details for that moment.
If an SQL statement is truncated in the GUI due to length limits, hover over it to view the full text.
Event Distribution
This section lists slow query events within the selected time range. Use this view to browse individual events and correlate slowdowns with specific time windows. Click an event to view its details.
From this section, you can also:
Select a node from the Node ID drop-down list to filter slow queries by node.
Click
to download the slow query logs.Click
to populate the current parameters into the OpenAPI console for API debugging.
Slow Query Log Statistics
Use this tab to identify which SQL templates are causing the most slowdowns and take action on them. The list aggregates statements by template, so you can rank by total impact rather than individual execution.
Configure filter conditions at the top of the list. Available filters vary by database engine.
Click an SQL ID to view the user distribution, client distribution, and metric trend details for that template.
Click Optimize in the Actions column to open the SQL Diagnostic Optimization dialog box. DAS evaluates the SQL based on statement complexity, table data volume, and database load. Diagnostic suggestions may take more than 20 seconds to appear. After diagnostics complete, the results include optimization suggestions and expected improvement estimates. To apply the suggestions, click Copy in the upper-right corner and paste the optimized SQL into your database client or Data Management (DMS) for execution. To discard the suggestions, click Cancel.
Click Throttling in the Actions column to open the SQL Throttling dialog box. For configuration details, see SQL throttling.
For PolarDB for MySQL clusters, click IMCI in the Actions column to view the In-Memory Column Index (IMCI) feature documentation.
NoteThe IMCI button appears only when all three conditions are met: no IMCI nodes are purchased for the cluster, the maximum execution duration of the SQL template exceeds 20 seconds, and the maximum number of scanned rows exceeds 200,000. Use IMCI to improve performance for complex queries on large datasets.
Slow Query Log Details
This tab lists individual SQL executions. Use this view to investigate a specific statement rather than a template pattern. Click Optimize or Throttling in the Actions column to run SQL diagnostics or configure throttling for a specific statement.
FAQ
Why does the execution completion time in slow query logs differ from the actual time?
This usually happens when an SQL statement modifies the session-level time zone. DAS records execution completion time based on whichever time zone is active at the following priority: session level > database level > system level. If a statement changes the session time zone, the recorded timestamp may not reflect the expected local time.
What's next
Enable DAS autonomy features to automatically handle slow queries as they are detected: