Overview
You can call this API to query high-risk SQL statements in a specified OB Cloud database instance and tenant during a specific period. You can set the time range, database name, node IP, and other filters to obtain a list of SQL statements that may affect the performance or stability of the database, such as those with excessive execution frequency or prolonged average CPU time.
API details
Constraints
The caller must have an AccessKey for accessing multi-cloud APIs. For information about how to obtain the AccessKey ID and AccessKey secret, see Manage AccessKeys.
Request path
GET /api/v2/instances/{instanceId}/tenants/{tenantId}/highRiskSql
Request parameters
| Parameter | Type | Required | Description | Example value |
|---|---|---|---|---|
| instanceId | string | Yes | The ID of the OB Cloud database instance. | obcluster-***** |
| tenantId | string | Yes | The ID of the tenant. | t4louaeei**** |
| requestId | string | Yes | The request ID for tracing. | dc302d76-66b5-48d8-ab53-a035******** |
| startTime | string | Yes | The start time of the query (UTC format). | 2026-02-25 15:40:43+00:00 |
| endTime | string | Yes | The end time of the query (UTC format). | 2026-02-26 10:40:43+00:00 |
| dbName | string | No | The name of the database, which is used to filter SQL statements. | N/A |
| nodeIp | string | No | The IP address of the node, which is used to filter SQL statements. | N/A |
| searchKeyWord | string | No | The SQL keyword for fuzzy matching. | update |
| sqlTextLength | integer | No | The maximum length of the returned SQL text. | 65535 |
| sqlId | string | No | The unique identifier of the SQL statement. | sql_123456789 |
| filterCondition | string | No | A custom filter condition. Fields are referenced using the @ symbol. For example, @avgCpuTime > 20 and @executions > 100. |
@avgCpuTime > 20 and @executions > 100 |
| httpServletRequest | unknown | Yes | The Http servlet request parameter. | N/A |
Response parameters
| Parameter | Type | Description |
|---|---|---|
| N/A | unknown | The JSON data structure returned by the API is unknown. Please process the actual response accordingly. |
Examples
Request example
curl -X GET \
-H "Content-Type: application/json" \
-u '<Your ak:sk>' \
'https://api-cloud.oceanbase.com/api/v2/instances/{instanceId}/tenants/{tenantId}/highRiskSql?requestId={requestId}&startTime={startTime}&endTime={endTime}&httpServletRequest={httpServletRequest}'
Response example
{
"server": "xxx.xxx.x.xxx:xxxx",
"data": [],
"errorMessage": "",
"successful": true,
"timestamp": 1731234567890
}
