DescribeSQLSamples

更新时间:
复制 MD 格式

Query sampled data for slow SQL execution details.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

oceanbase:DescribeSQLSamples

get

*All Resource

*

None None

Request parameters

Parameter

Type

Required

Description

Example

InstanceId

string

No

The ID of the OceanBase cluster.

ob317v4uif****

TenantId

string

No

The ID of the tenant.

t4louaeei****

StartTime

string

Yes

The start time to query for slow SQL executions.

The time must be in UTC format: YYYY-MM-DDThh:mm:ssZ.

2023-04-12T04:38:38Z

EndTime

string

Yes

The end time to query for slow SQL executions.

The time must be in UTC format: YYYY-MM-DDThh:mm:ssZ.

2023-04-12T05:38:38Z

DbName

string

Yes

The name of the database.

test_db

SqlId

string

Yes

The SQL ID.

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

ReturnSqlText

boolean

No

Specifies whether to return the SQL text.

true

Response elements

Element

Type

Description

Example

object

The response parameters.

RequestId

string

The request ID.

EE205C00-30E4-****-****-87E3A8A2AA0C

Data

array<object>

A list of slow SQL execution samples.

object

A slow SQL execution sample.

RequestId

string

The request ID.

EE205C00-30E4-****-****-87E3A8A2AA0C

TraceId

string

The trace ID.

YB42C****-0005E303D1****-0-0

RequestTime

string

The time the SQL request was made.

2023-04-12T04:46:38Z

Server

string

The server that executed the SQL statement.

i-bp1db1****8uemejio

ClientIp

string

The client's IP address.

i-bp1db****38uemejio

ClientPort

string

The client port.

4****

DbName

string

The database name.

test_db

UserName

string

The username.

test_user

SqlType

string

The SQL statement type.

select

PlanId

number

The execution plan ID.

590****

AffectedRows

number

The number of rows affected by the execution.

10000.0

ReturnRows

number

The number of rows returned by the execution.

0.0

PartitionCount

number

The number of partitions accessed during the execution.

1.0

RetCode

number

The result code.

0

WaitEvent

string

The longest wait event during the execution.

none

WaitTime

number

The wait time, in milliseconds.

0.0

WaitCount

number

The number of waits.

0.0

RpcCount

number

The RPC count.

8.0

PlanType

string

The plan type.

LOCAL

Inner

boolean

Indicates whether the SQL statement is internal.

false

ExecutorRpc

boolean

Indicates whether an RPC was initiated.

0.0

HitPlan

boolean

Indicates whether the execution plan was hit.

true

ElapsedTime

number

The response time, in milliseconds.

2182.66

CpuTime

number

The CPU time, in milliseconds.

3377.57

NetTime

number

The network transport time, in milliseconds.

0.0

NetWaitTime

number

The network queuing time, in milliseconds.

0.0

QueueTime

number

The queue time, in milliseconds.

0.02

DecodeTime

number

The syntax parsing time, in milliseconds.

0.0

GetPlanTime

number

The plan generation time, in milliseconds.

0.19

ExecuteTime

number

The plan execution time, in milliseconds.

8262.01

ApplicationWaitTime

number

The wait time for Application events, in milliseconds.

0.0

ConcurrencyWaitTime

number

The wait time for Concurrency events, in milliseconds.

0.0

UserIoWaitTime

number

The wait time for UserIO events, in milliseconds.

0.0

ScheduleTime

number

The wait time for Schedule events, in milliseconds.

0.0

RowCacheHit

number

The number of row cache hits.

498.0

BloomFilterCacheHit

number

The number of Bloom filter cache hits.

0.0

BlockCacheHit

number

The number of block cache hits.

99279.0

BlockIndexCacheHit

number

The number of block index cache hits.

142514.0

DiskReads

number

The number of disk reads.

96972.0

RetryCount

number

The number of retries.

0

TableScan

boolean

Indicates whether a full table scan was performed.

false

ConsistencyLevel

string

The consistency level.

3

MemstoreReadRows

number

The number of rows read from the Memstore.

0

ExpectedWorkerCount

number

The degree of parallelism.

0

UsedWorkerCount

number

The actual number of worker threads used.

0

SsstoreReadRows

number

The number of rows read from the SSStore.

986190

ObServerId

number

The server ID.

2

ObUserId

number

The user ID.

100010

ObDbId

number

The database ID.

11006111****4828

Statement

string

The parameterized SQL statement.

select a from b

TransHash

string

The transaction hash.

1219****927****73791

FullSqlText

string

The complete SQL statement.

Note

This parameter is temporarily unavailable.

select * from test where c1 > 1 and c2 > 3;

SqlText

string

The SQL statement.

select ** from t

ParamsValue

string

The SQL parameter values.

1****

SqlId

string

SqlTextShort

string

Examples

Success response

JSON format

{
  "RequestId": "EE205C00-30E4-****-****-87E3A8A2AA0C",
  "Data": [
    {
      "RequestId": "EE205C00-30E4-****-****-87E3A8A2AA0C",
      "TraceId": "YB42C****-0005E303D1****-0-0",
      "RequestTime": "2023-04-12T04:46:38Z",
      "Server": "i-bp1db1****8uemejio",
      "ClientIp": "i-bp1db****38uemejio",
      "ClientPort": "4****",
      "DbName": "test_db",
      "UserName": "test_user",
      "SqlType": "select",
      "PlanId": 0,
      "AffectedRows": 10000,
      "ReturnRows": 0,
      "PartitionCount": 1,
      "RetCode": 0,
      "WaitEvent": "none",
      "WaitTime": 0,
      "WaitCount": 0,
      "RpcCount": 8,
      "PlanType": "LOCAL",
      "Inner": false,
      "ExecutorRpc": true,
      "HitPlan": true,
      "ElapsedTime": 2182.66,
      "CpuTime": 3377.57,
      "NetTime": 0,
      "NetWaitTime": 0,
      "QueueTime": 0.02,
      "DecodeTime": 0,
      "GetPlanTime": 0.19,
      "ExecuteTime": 8262.01,
      "ApplicationWaitTime": 0,
      "ConcurrencyWaitTime": 0,
      "UserIoWaitTime": 0,
      "ScheduleTime": 0,
      "RowCacheHit": 498,
      "BloomFilterCacheHit": 0,
      "BlockCacheHit": 99279,
      "BlockIndexCacheHit": 142514,
      "DiskReads": 96972,
      "RetryCount": 0,
      "TableScan": false,
      "ConsistencyLevel": "3",
      "MemstoreReadRows": 0,
      "ExpectedWorkerCount": 0,
      "UsedWorkerCount": 0,
      "SsstoreReadRows": 986190,
      "ObServerId": 2,
      "ObUserId": 100010,
      "ObDbId": 0,
      "Statement": "select a from b",
      "TransHash": "1219****927****73791",
      "FullSqlText": "select * from test where c1 > 1 and c2 > 3;",
      "SqlText": "select ** from t",
      "ParamsValue": "1****",
      "SqlId": "",
      "SqlTextShort": ""
    }
  ]
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.