Updated on 2024-04-11 GMT+08:00

Slow Query Log

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, client IP address, or SQL template. It helps you quickly identify bottlenecks and improve instance performance.

Procedure

  1. Log in to the management console.
  2. Click in the upper left corner and select a region and a project.
  3. Click in the upper left corner of the page and choose Databases > Relational Database Service.
  4. On the Instances page, click the DB instance name.
  5. In the navigation pane, choose DBA Assistant > Historical Diagnosis.
  6. Click the Slow Query Log tab.
  7. Click next to the Collect Slow Query Logs field.
  8. Click Log Settings in the upper right corner of the page to adjust the slow query log threshold.

    Figure 1 Setting the slow query log threshold

  9. View slow queries over time for the last 1 hour, last 3 hours, last 12 hours, or a custom time period (spanning no more than one day), slow log details, and template statistics.

    Figure 2 Slow query log
    • The collection of slow query logs is delayed for 1 to 3 minutes.
    • You can search for slow query log details by database, client IP address, user, or execution duration.
    • You can search for template information by database.
    • To export slow query log information, click .
    • To view log export history, click View Export List.