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 diagnosis results and optimization suggestions of SQL queries.

View slow log trends and statistics

  1. Log on to the PolarDB console.
  2. On the top of the page, select the region where the target cluster is located.
  3. Find the target cluster and click the cluster ID to go to the Overview page.
  4. In the left-side navigation pane, choose Diagnostics and Optimization > Slow SQL Query.
  5. In the Slow Log Trend section, use one of the following methods to view slow log trends:
    • Click Last 15 Minutes, 30 Minutes, or 1 Hour to view the slow log trends in the last 15 minutes, the last 30 minutes, or the last hour.
    • Specify the start time and the end time of the query, and click Search to view the slow log trends within a maximum of seven days.
    Note By default, the slow log trends within the last 15 minutes appear.
    Slow log trends
  6. Optional:To view the slow log trends of a specific node, click the ID of the node in the Nodes section.
    单机节点
  7. In the Slow Log Trend section, click a time point in the line chart. On the Slow Log Statistics tab, you can view the slow log statistics that are generated within the 1-minute period. The start time of the 1-minute period is the time point you click in the line chart.
    Slow log statistics
  8. To troubleshoot slow SQL queries, use one of the following methods:
    • In the Actions column of the slow SQL query, click Sample to view the details of the slow SQL query.Sample
    • In the Actions column of the slow SQL query, click Optimize to view the diagnosis results and optimization suggestions of the slow SQL query.Optimization
      Note You can also click Database Expert Service to purchase Database Expert Service. Database Expert Service provides professional database services that are not provided by PolarDB, such as emergency solutions, health diagnostics, performance optimization, security assurance, and data migration.

Export slow logs

You can click Export Slow Log to export slow logs, and save the slow logs on the on-premises machines.Export