All Products
Search
Document Center

ApsaraDB for OceanBase:DescribeOasAnomalySQLList

Last Updated:Dec 02, 2024

You can call this API to view the list of SQL statements that are identified as having performance issues by the diagnostic system.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
oceanbase:DescribeOasAnomalySQLListget
*All Resources
*
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
InstanceIdstringYes

The ID of the OceanBase cluster.

ob317v4uif****
TenantIdstringYes

The ID of the tenant.

t4louaeei****
StartTimestringYes

The start time of the monitoring data.
The value must be UTC time in the format of YYYY-MM-DDThh:mm:ssZ.

2023-04-12T04:38:38Z
EndTimestringYes

The end time of the monitoring data.
The value must be UTC time in the format of YYYY-MM-DDThh:mm:ssZ.

2023-04-12T05:38:38Z
DbNamestringNo

The name of the database.

db_****
SearchKeyWordstringNo

The search keyword.

update
SearchParamstringNo

The search parameter.

cputime
SearchRulestringNo

The search rule.
Valid values: "=", ">", ">=", "<", and "<="

>
SearchValuestringNo

The search value.

0.01
SqlIdstringNo

SQL ID.

8D6E84****0B8FB1823D199E2CA1****
NodeIpstringNo

The node IP.

i-bp19y05uq6x*********
FilterConditionstringNo

All parameters are referenced by the symbol @. For a list of available parameters, refer to the returned parameters in Query performance indicators of an SQL statement.

@avgCpuTime > 20 and @executions > 100
AcceptLanguagestringNo

The language of the response. Valid values:

  • zh: Chinese
  • en: English
zh-CN
SqlTextLengthlongNo

Max length of the returned SQL text.

65535
CurrentlongNo

The current page.

1
PageSizelongNo

Page size.

  • Start value: 1
  • Default value: 1
10

Response parameters

ParameterTypeDescriptionExample
object

Returned response.

Dataarray<object>

The list of suspicious SQLs.

Dataobject
AvgCpuTimedouble

Average CPU time of the suspicious SQL.

100.24
AvgElapsedTimedouble

Average response time of the suspicious SQL.

100.28
AvgGetPlanTimedouble

Average time to obtain the execution plan of the suspicious SQL.

0
CpuTimedouble

CPU time of the suspicious SQL.

100.23
DbNamestring

The name of the database.

db_***
DiagTypesarray

The type of the diagnosis.

DiagTypesstring

The type of the diagnosis.

[ "TABLE_SCAN_INDEX_NOT_USED" ]
Diagnosisstring

The details of diagnosis.

Executionsdouble

Total execution count of the suspicious SQL.

1
LastExecutedTimedouble

Last execution time of the suspicious SQL.

2023-04-12T04:38:38Z
RiskLevelstring

Risk level.

high
SqlIdstring

SQL ID.

8D6E84****0B8FB1823D199E2CA1****
SqlTextShortstring

Prefix of the SQL text.

delete /*+ XXX PARALLEL(4) */ from
Suggestionstring

Suggestion for the suspicious SQL.

review
SumElapsedTimestring

Total response time of the suspicious SQL.

11452126.36
UserNamestring

Username.

test_user
RequestIdstring

The request ID.

473469**-AA6F-4D**-B3DB-A***********
TotalCountlong

The total count.

9

Examples

Sample success responses

JSONformat

{
  "Data": [
    {
      "AvgCpuTime": 100.24,
      "AvgElapsedTime": 100.28,
      "AvgGetPlanTime": 0,
      "CpuTime": 100.23,
      "DbName": "db_***",
      "DiagTypes": [
        "[\n        \"TABLE_SCAN_INDEX_NOT_USED\"\n      ]"
      ],
      "Diagnosis": "",
      "Executions": 1,
      "LastExecutedTime": 0,
      "RiskLevel": "high",
      "SqlId": "8D6E84****0B8FB1823D199E2CA1****",
      "SqlTextShort": "delete /*+ XXX PARALLEL(4) */ from",
      "Suggestion": "review",
      "SumElapsedTime": "11452126.36",
      "UserName": "test_user"
    }
  ],
  "RequestId": "473469**-AA6F-4D**-B3DB-A***********",
  "TotalCount": 9
}

Error codes

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2024-10-29The response structure of the API has changedView Change Details
2024-02-02The response structure of the API has changedView Change Details
2023-08-21The request parameters of the API has changed. The response structure of the API has changedView Change Details