Updated on 2025-08-20 GMT+08:00

Viewing Slow Query Logs of a DB Instance

Scenarios

Slow Query Log displays a chart of SQL statements that are taking too long to execute and allows you to sort slow SQL statements by multiple dimensions, such as by user, host, or SQL template. It helps you quickly identify bottlenecks and improve instance performance.

Procedure

  1. Click in the upper left corner and select a region.
  2. Click in the upper left corner of the page and choose Databases > Relational Database Service.
  3. On the Instances page, click the target instance name.
  4. In the navigation pane, choose DBA Assistant > Historical Diagnosis.
  5. Click the Slow Query Log tab.

    Slow SQL Analysis needs to be purchased separately. To use this function, subscribe to Intelligent O&M first.

  6. Click Subscribe. In the displayed dialog box, you can learn about Intelligent O&M functions and pricing.
  7. After subscribing to Intelligent O&M, view slow queries over time of your instance.
  8. You can view slow queries over time and you can see the slow log archive history for the last 1 hour, last 3 hours, last 12 hours, or a custom time period (spanning no more than one day).
  9. To export slow query log details or statistics, click the Details or Statistics tab above the log list and click Export on the tab page.

Follow-up Operations

To view historical export records, do as follows:

  1. Above the log list, click the Details or Statistics tab.
  2. Click View All Export Records. The displayed dialog box shows all historical export records.