PolarDB for MySQL provides the slow SQL analysis feature. You can view the trends and statistics of slow SQL statements and obtain suggestions and diagnostic analysis.

View trends and statistics for slow SQL statements

  1. Log on to the ApsaraDB for PolarDB console.
  2. In the upper-left corner of the console, select the region where the cluster is located.
  3. Click the ID of the cluster.
  4. In the left-side navigation pane, choose Diagnostics and Optimization > Slow SQL Query.
  5. You can use any of the following methods to view the Slow Log Trend:
    • Click Last 24 Hours to view the slow log trend of the last 24 hours.
    • Specify the start time and end time of the query and click Search to view the slow log trends for up to seven days.
    Note By default, the slow log trends of the last 24 hours are displayed.
  6. On the trend chart of Slow Log Trend, click the specific period of time to view Slow Log Statistics at the lower part of the page.
  7. You can troubleshoot slow SQL statements in the following ways:
    • Click Sample in the corresponding Actions column to view the details of the slow SQL statement.
    • Click Optimization in the corresponding Actions column to view the optimization suggestions of the diagnosis.
      Note You can also click Expert Service to purchase Database Expert Service. Database Expert Service provides professional database services that are not provided by ApsaraDB for PolarDB, for example, emergency solutions, health diagnosis, performance optimization, security, and Oracle migration.

Export slow logs

You can click Export Slow Log to save and view slow logs.Export