Suspicious SQL statements are those that are executed in the database and have potential risks or abnormal behaviors. OceanBase Cloud displays the executed abnormal SQL statements to provide clearer guidance for SQL optimization.
Query the list of suspicious 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 SQL tab of the Diagnostics page, select Suspicious SQL.
(Optional) Configure the filter conditions.
Database: Select any database in 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 limit: The selected time range must not exceed 24 hours.
- Minimum range limit:
- 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, separated by half-width characters , or ;.
SQL text: Enter the SQL text keyword to query. The query results will display SQL statements containing this keyword. Constant search is not supported.
More Conditions: Click +Add, and in the Add More Conditions panel, configure the metrics, operators, and metric values. During the query, the SQL statements that meet the conditions will be displayed in the query result list.
Click Query.
If you enable Aggregation In Query, the results of in queries will be aggregated, but the statistical data will remain unchanged. In the list, you can see the Aggregated identifier. Hover the pointer over the corresponding SQL ID to view other SQL IDs that are aggregated.
Note
For SQL statements that contain the IN clause and have different numbers of simple constants, if the Aggregate in Query feature is not enabled, the real-time diagnosis feature will treat them as different types of SQL statements. If the Aggregate in Query feature is enabled, the real-time diagnosis feature will treat them as the same type of SQL statements and aggregate their statistical information into the same row.
Click the download icon to download the list of suspicious SQL statements.
Click the icon
to query more metrics in the Manage Columns window.