Slow SQL refers to an SQL statement whose response time exceeds 500 ms.
View the list of Slow SQL statements
Log in to the OceanBase Cloud console.
In the left-side navigation pane, click Instances.
In the instance list, find the target instance, click the instance name, and go to the Overview page of the instance.
Click Diagnostics in the left-side navigation pane, and then select the Diagnostics tab.
On the SQL tab, select Slow SQL.
(Optional) Configure filter conditions.
Database: Select any database in the current cluster.
Time range: Supports viewing data in the following time ranges: Past 5 Minutes, Past 30 Minutes, Past 1 Hour, Past 3 Hours, and Past 6 Hour(s). You can also customize the time range (up to 15 days), but note the following limitations:
- Maximum range limit: The selected time range must not exceed 24 hours.
- Minimum range limit:
- For data within 3 days: The selected time range must be at least 1 minute.
- For data from 3 to 7 days: The selected time range must be at least 5 minutes.
- For data beyond 7 days: The selected time range must be at least 20 minutes.
SQL ID: Enter the SQL ID to be queried. You can enter multiple IDs and separate them with half-width characters , or ;.
SQL text: Enter the SQL text keywords to be queried. The query results will display the SQL containing the keyword in the SQL text. Constant search is not supported.
More Conditions: Click +Add, and in the Add More Conditions panel, configure the metric, operator, and value. When querying, the SQL that meets the metric conditions will be displayed in the query result list.
Quick Filter: Supports the following options: Full Table Scan, Multi-partition scan, Multiple Remote Executions, Hard Parsing, Error Executions, and Retry execution.
Click Query.
The Slow SQL tab displays the following metrics by default: SQL text, Tenant Name, SQL ID, Database, Total Executions, Total DB Time (ms), Avg Time (ms), Max Response Time (ms), CPU time (ms), Plan Generation Time (ms), Max Rows Returned, Rows of Memory Reads, Rows of Physical Reads, and Actions.
You can filter SQL text by Tenant Name and Database.
You can sort SQL text by Total Executions, Total DB Time (ms), Avg Time (ms), Max Response Time (ms), CPU time (ms), Plan Generation Time (ms), Max Rows Returned, Rows of Memory Reads, and Rows of Physical Reads.
In the Actions column, click View samples to view SQL samples.
In the Actions column of a SQL statement, click ... and select Set Throttling to set throttling limits. You can select multiple SQL statements to set throttling limits in batches.
Check Aggregation In Query in the upper-right corner of the list to display SQL statements in aggregation queries, without affecting statistics. You can select multiple SQL statements, including those in aggregation queries, to set throttling limits in batches.
Note
Aggregation in Query means that the number of constant parameters in the in clause of the SQL statement is ignored, and each in clause is treated as having only one constant parameter. The SQL statements are then parameterized and the SQL ID is calculated according to the rules. SQL statements with the same SQL ID are classified as the same type and aggregated.
Choose ... > Download Table to download the Slow SQL list.
Choose ... > Modify Slow SQL Threshold. In the dialog box that appears, modify the Slow SQL threshold and click OK.
Click the icon
to query more metrics in the Manage Columns window that appears.