You need to enable JavaScript to run this app.
Database Workshop

Database Workshop

Copy page
Download PDF
Quick start
Querying a slow log through operation observability
Copy page
Download PDF
Querying a slow log through operation observability
This topic describes how to query slow logs (i.e., logs of slow SQL queries) that are generated in the past 24 hours for the target instance in Database Workshop (DBW). RDS for MySQL is used as an example.​
Prerequisites​
tip​
The account you create must be granted the required permissions, such as querying and modifying the specified database.​
Procedure​
  1. Log on to the DBW console.​
  1. On the left navigation bar, click Operation and maintenance management > Observation diagnosis.​
  1. On the Observation diagnosis page, click Slow log analysis.​
  1. On the upper-left corner of the Slow log analysis tab, switch to the target region and the target instance.​
  1. On the Slow log analysis tab of the target instance, select Past 24 hours from the Time drop-down list. You can view the detailed information as required.​
  • View slow log trends: On the left pane of the Slow log analysis tab, you can view the slow log trends in the past 24 hours. In addition, you can click a time point to view the slow SQL number and CPU usage of the time point.​
  • View slow log statistics: On the right pane of the Slow log analysis tab, you can view slow SQL TOP point of the day within a time range, that is, top points within the [NowTime-24h, NowTime] time range, and view Slow SQL 7-day top point within a time range, that is, top points within the [Now Time-7*24h, NowTime] time range.​
  • View slow log details: On the in slow SQL list pane, you can view all slow logs for a certain time range, filter slow logs, and view details of slow logs.​
tip​
On the slow SQL list pane, you can view slow SQL log details in two ways:​
  • On the Slow Log trend pane, click a specified time point.​
  • On the right pane of the Slow log analysis tab, click a target time in Slow SQL TOP point of the day or Slow SQL 7-day top point.​
  • View all slow SQL logs of a specified time range. Detailed information includes SQL template, Database, Executive user, IP source, Average execution time(s), Average number of rows returned, Maximum lock wait time(s), First appearance time, and Last appearance time.​
  • To filter slow SQL logs, click Advanced filtering, and then filter slow logs by Aggregation method, Database, User, IP, Keywords, or Time consuming interval as required.​
  • To view the details of slow SQL logs, click the target SQL template and then go to the SQL details panel to view the details displayed on the Execution details, Execution statistics, and SQL analysis tabs. The following table describes the tabs.​
  • ​
    Tab​
    Description​
    Execution details​
    On the Execution details tab, you can view Start Time, SQL text, Database, Executive user, IP source, Execution time(s), Lock wait time(s), Number of rows scanned, and Number of rows returned of each SQL statement.​
    In addition, you can click the Copy icon to copy SQL text. On the Advanced filtering pane, you can skip setting Executive user or IP source, and then click the Filter icon on the right of Executive user or IP source to filter the results by user or IP address.​
    Execution statistics​
    On the Execution statistics tab, you can view the information about all the SQL text that meets the filter criteria in the SQL template.​
    • Total time spent: the percentage of the total query time of the current SQL template in the total query time of all SQL log lists in the past 24 hours.​
    • Total lock waiting time ratio: the percentage of the total lock latency of the current SQL template in the total lock latency of all SQL log lists in the past 24 hours.​
    • Proportion of total scanned lines: the percentage of the total scanned rows of the current SQL template in the total scanned rows of all SQL log lists in the past 24 hours.​
    • Percentage of total rows returned: the percentage of the total returned rows of the current SQL template in the total returned rows of all SQL log lists in the past 24 hours.​
    • SQL Number of executions: the development trends of slow SQL logs within the filter time range.​
    • Run profiling: the execution status of SQL statements in each stage. This information helps you analyze and locate problems.​
    SQL analysis​
    On the SQL analysis tab, you can view the following information:​
    • SQL text: the information about all SQL text in the SQL template. You can click the Copy icon to copy the SQL text.​
    • Execution plan: the execution plan. Valid values: select_type information interpretation, Type information interpretation, and Extra information interpretation.​
    tip​
    When you execute SELECT, DELETE, INSERT, REPLACE, or UPDATE statements without sleep or benchmark, this tab can display Execution plan.​
    • Optimization suggestions: suggestions on optimizing SQL statements. You can refer to the suggestions to optimize your SQL statements.​
    ​
Relevant API​
​
API​
Description​
Call the DescribeSlowLogs to query the slow log information.​
​
​
Last updated: 2026.01.16 17:18:36