High-risk SQL refers to SQL statements that can potentially harm the system's performance, security, and data.
Background information
High-risk SQL is categorized into two types:
SQL statements that return more than 50,000 rows, affect more than 50,000 rows, or involve more than 50 partitions.
SQL statements that meet the following conditions:
- DROP TABLE/ DATABASE
- TRUNCATE TABLE
- ALTER TABLE
- ADD/DROP COLUMN
- UPDATE TABLE without a condition or with a condition that is always true
- DELETE FROM without a condition or with a condition that is always true
Query the list of high-risk 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 instance overview page.
In the left-side navigation pane, click Tenants.
In the tenant management list, click the name of the target tenant to go to the tenant overview page.
In the left-side navigation pane, click Diagnostics.
On the Diagnostics page, click the SQL tab and select High-risk SQL.
(Optional) Configure the filter conditions.
Database: Select any database under the current tenant.
Time range: Select a time range. You can also customize the time range (up to 7 days), but note the following limitations:
- Maximum range: The selected time range must not exceed 24 hours.
- Minimum range:
- Within 3 days: The selected time range must be at least 1 minute.
- Between 3 and 7 days: The selected time range must be at least 5 minutes.
SQL ID: Enter the SQL ID to query. You can enter multiple IDs and separate them with half-width characters , or ;.
SQL text: Enter the SQL text keyword to query. The query results will display SQL statements containing the keyword. Constant search is not supported.
More Conditions: Click +Add and in the Add More Conditions panel, configure the metric, operator, and metric value. During the query, the SQL statements that meet the conditions will be displayed in the query result list.
Click Query.
Filter the SQL text by Database, User, and SQL Type.
Sort the SQL text by Request IP Address.
Click the download icon to download the list of high-risk SQL statements.
Click the icon
to open the Manage Columns window and query more metrics.