All Products
Search
Document Center

ApsaraDB for OceanBase:DescribeSQLTuningAdvices

Last Updated:Nov 14, 2025

You can call this operation to query SQL optimization suggestions for two purposes: creating indexes and binding execution plans.

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:
    • For mandatory resource types, indicate with a prefix of * .
    • 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:DescribeSQLTuningAdvicesget
*All Resources
*
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
InstanceIdstringYes

The ID of the OceanBase cluster.

obsdf43****
TenantIdstringYes

The ID of the tenant.

tsdc2s2****
DbNamestringYes

The name of the database.

testdb
SqlIdstringYes

The ID of the SQL statement.

123456
StartTimestringYes

The start time.

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

The end time.

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

The supported language. Valid values:

  • zh-CN
  • en-US
zh-CN

Response parameters

ParameterTypeDescriptionExample
object

The return result of the request.

RequestIdstring

The ID of the request.

473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E
Dataarray<object>

The returned data.

Dataobject

The information about the execution plans of the SQL statement.

Typestring

The optimization type.

PLAN_BINDING/INDEX_CREATION
ColumnNamesstring

The sequence of index columns.

c1;c2;c3
LocalityTypestring

The type of the index.

Local/Global
Columnsarray<object>

The list of index columns.

Columnsobject

The information about index columns.

ColumnNamestring

The name of the column.

xxxx
Ndvfloat

The NDV of the column.

100
MinValuestring

The minimum value of the column.

1
MaxValuestring

The maximum value of the column.

100
DbNamestring

The name of the database.

test_db
Tablestring

The name of the table.

test_table
Planobject

The execution plan.

Executionslong

The total number of executions within the specified period of time.

2062
AvgCpuTimefloat

The average CPU time within the specified period of time, in milliseconds.

100.36
PlanHashstring

The unique identifier of the execution plan in the diagnostic system.

-86290582****886880
TimeoutPercentagefloat

The percentage of executions with a timeout error.

0
AvgConcurrencyWaitTimefloat

The average amount of time spent on a Concurrency wait event within the specified period of time, in milliseconds.

0
FirstLoadTimeUslong

The time when the execution plan was loaded for the first time.

1672367130576163
AvgDiskWritesfloat

The average number of physical writes within the specified period of time.

0
AvgUserIoWaitTimefloat

The average amount of time spent on a UserIo wait event within the specified period of time, in milliseconds.

0
PlanSizelong

The size of the execution plan.

49216
ServerSnstring

The ID of the node.

i-bp1*****sw64dhb*****
OutlineDatastring

The outline_data field of the execution plan.

xxxxx
PlanTypestring

The type of the execution plan. Valid values: LOCAL, REMOTE, and DIST.

LOCAL
ObDbIdlong

The ID of the database.

1108307720799259
HitPercentagefloat

The hit rate.

66.8
AvgBufferGetsfloat

The average number of cache reads within the specified period of time.

0
ExecPsfloat

The average number of executions per second within the specified period of time.

1.45
DelayedLargeQueryPercentagefloat

The percentage of delayed long-running queries.

0
TableScanboolean

Indicates whether full table scan is performed.

false
LargeQueryPercentagefloat

The percentage of completed long-running queries.

0
SchemaVersionlong

The version of the schema.

1672367130529680
PlanIdlong

The ID of the execution plan.

818
FirstLoadTimestring

The time when the execution plan was loaded for the first time.

2022-12-30T02:25:30.576Z
AvgRowProcessedfloat

The average wait time of row processing within the specified period of time, in milliseconds.

1
MergedVersionlong

The version of the major compaction.

3
HitDiagnosisboolean

Indicates whether the diagnosis is hit.

false
Uidstring

The unique identifier of the execution plan.

AAAAAAAAAAEAAAAAAAADMgAF8QJQwIUj
AvgApplicationWaitTimefloat

The average amount of time spent on an Application wait event within the specified period of time, in milliseconds.

0
CollectTimeUslong

The period of time during which data is collected.

1672358400000000
AvgElapsedTimefloat

The average interval wait time within the specified period of time, in milliseconds.

713.62
ObServerIdlong

The ID of the server.

1
OutlineIdlong

The ID of the outline.

1
AvgDiskReadsfloat

The average number of physical reads within the specified period of time.

0

Examples

Sample success responses

JSONformat

{
  "RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E",
  "Data": [
    {
      "Type": "PLAN_BINDING/INDEX_CREATION",
      "ColumnNames": "c1;c2;c3",
      "LocalityType": "Local/Global",
      "Columns": [
        {
          "ColumnName": "xxxx",
          "Ndv": 100,
          "MinValue": 1,
          "MaxValue": 100
        }
      ],
      "DbName": "test_db",
      "Table": "test_table",
      "Plan": {
        "Executions": 2062,
        "AvgCpuTime": 100.36,
        "PlanHash": "-86290582****886880",
        "TimeoutPercentage": 0,
        "AvgConcurrencyWaitTime": 0,
        "FirstLoadTimeUs": 1672367130576163,
        "AvgDiskWrites": 0,
        "AvgUserIoWaitTime": 0,
        "PlanSize": 49216,
        "ServerSn": "i-bp1*****sw64dhb*****",
        "OutlineData": "xxxxx",
        "PlanType": "LOCAL",
        "ObDbId": 1108307720799259,
        "HitPercentage": 66.8,
        "AvgBufferGets": 0,
        "ExecPs": 1.45,
        "DelayedLargeQueryPercentage": 0,
        "TableScan": false,
        "LargeQueryPercentage": 0,
        "SchemaVersion": 1672367130529680,
        "PlanId": 818,
        "FirstLoadTime": "2022-12-30T02:25:30.576Z",
        "AvgRowProcessed": 1,
        "MergedVersion": 3,
        "HitDiagnosis": false,
        "Uid": "AAAAAAAAAAEAAAAAAAADMgAF8QJQwIUj",
        "AvgApplicationWaitTime": 0,
        "CollectTimeUs": 1672358400000000,
        "AvgElapsedTime": 713.62,
        "ObServerId": 1,
        "OutlineId": 1,
        "AvgDiskReads": 0
      }
    }
  ]
}

Error codes

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

Change history

Change timeSummary of changesOperation
2025-07-08The response structure of the API has changedView Change Details