機能説明
指定された期間内における特定のスローSQLステートメントの実行詳細サンプルデータを照会します。このインターフェースを通じて、SQL実行の詳細なパフォーマンス指標、リソース消費、待機イベントなどの情報を取得し、SQLパフォーマンス分析と最適化を支援します。
呼び出し説明
インターフェース制約
呼び出し元はマルチクラウドAPIへのアクセスキーを保有している必要があります。AccessKey IDとAccessKey Secretの取得方法については、アクセスキーの管理をご参照ください。
リクエストパス
GET /api/v2/instances/{instanceId}/tenants/{tenantId}/sqls/{sqlId}/samples
リクエストパラメータ
Path
名前 |
型 |
必須 |
説明 |
例値 |
|---|---|---|---|---|
| instanceId | String | はい | OceanBaseクラスタID | obcluster-***** |
| tenantId | String | はい | テナントID | t4louaeei**** |
| sqlId | String | はい | SQLステートメントの一意の識別子 | sql_123456789 |
Query
名前 |
型 |
必須 |
説明 |
例値 |
|---|---|---|---|---|
| requestId | String | はい | リクエストID、追跡に使用 | dc302d76-66b5-48d8-ab53-a035******** |
| dbName | String | いいえ | データベース名 | test11 |
| startTime | String | はい | 開始時間(UTC) | 2026-02-25 15:40:43+00:00 |
| endTime | String | はい | 終了時間(UTC) | 2026-02-26 10:40:43+00:00 |
戻り結果
パラメータ名 |
型 |
説明 |
例 |
|---|---|---|---|
| data | Object | データ | {} |
| dataList | Array | データリスト | [] |
| causeType | String | サンプリングタイプ | SLOW_SQL |
| affectedRows | Long | 期間内の平均更新行数 | 0 |
| blockCacheHit | Double | BlockCacheヒット回数 | 0.0 |
| blockIndexCacheHit | Double | BlockIndexCacheヒット回数 | 0.0 |
| bloomFilterCacheHit | Double | BloomFilterCacheヒット回数 | 0.0 |
| clientIp | String | クライアントIPアドレス | xx.xx.xx.xx |
| clientPort | Long | クライアントポート | 19580 |
| cpuTime | Double | CPU時間(ミリ秒) | 1949.68 |
| dbName | String | データベース名 | test11 |
| decodeTime | Double | 構文解析時間(ミリ秒) | 0.0 |
| diskReads | Double | ディスク読み取り回数 | 0.0 |
| elapsedTime | Double | 応答時間(ミリ秒) | 1956.43 |
| executeTime | Double | プラン実行時間(ミリ秒) | 1949.66 |
| executorRpc | Boolean | RPCを発信したかどうか | false |
| expectedWorkerCount | Long | パラレル度 | 0 |
| fullSqlText | String | 完全なSQLテキスト。 | select * from high_d |
| getPlanTime | Double | プラン生成時間(ミリ秒) | 0.03 |
| hitPlan | Boolean | 実行計画にヒットしたかどうか | true |
| inner | Boolean | 内部SQLかどうか | false |
| memstoreReadRows | Long | MemStore読み取り行数 | 0 |
| netTime | Double | ネットワーク転送時間(ミリ秒) | 0.0 |
| netWaitTime | Double | ネットワークキューイン時間(ミリ秒) | 0.0 |
| partitionCount | Long | 期間内の平均アクセスパーティション数 | 1 |
| planId | Long | 実行計画ID | 1049 |
| planType | String | プランタイプ | LOCAL |
| queueTime | Double | キューイン時間(ミリ秒) | 6.75 |
| requestId | Long | リクエストID | 369604 |
| requestTime | String | SQLのリクエスト時間 | 2025-12-23T06:47:06.207Z |
| retCode | Long | 結果コード | 0 |
| retryCount | Long | 再試行回数 | 0 |
| returnRows | Long | 期間内の平均返却行数 | 1 |
| rowCacheHit | Double | RowCacheヒット回数 | 0.0 |
| rpcCount | Long | RPC送信回数 | 0 |
| server | String | SQL実行サーバー | i-uf******** |
| sqlId | String | SQL ID | 5D51DC02208F9A448157FD8A******** |
| sqlTextShort | String | SQL短文 | select * from high_disk_read_2 where id > ? order by id desc limit ? |
| sqlType | String | SQLタイプ | SELECT |
| ssstoreReadRows | Long | Ssstore読み取り行数 | 525 |
| tableScan | Boolean | フルテーブルスキャンかどうか | true |
| traceId | String | TraceId | YB420A7100C3-00064694CC824665-0-0 |
| transHash | String | transaction hash | 0 |
| usedWorkerCount | Long | SQL実際実行スレッド数 | 0 |
| userClientIp | String | ユーザークライアントIPアドレス | xx.xx.xx.xx |
| userName | String | ユーザー名 | test11 |
| waitCount | Long | 待機回数 | 0 |
| waitEvent | String | 期間内の最長待機イベント | event:, p1text:, p1:0, p2text:, p2:0, p3text:, p3:0 |
例
リクエスト例
curl --digest -u '<Your AK:SK>' \
-X GET \
'https://api-cloud.oceanbase.com/api/v2/instances/{instanceId}/tenants/{tenantId}/sqls/{sqlId}/samples?requestId={requestId}&startTime={startTime}&endTime={endTime}' \
-G \
-d 'dbName={dbName}'
戻り値の例
JSON 形式
{
"data": {
"dataList": [
{
"affectedRows": 0,
"blockCacheHit": 0.0,
"blockIndexCacheHit": 0.0,
"bloomFilterCacheHit": 0.0,
"clientIp": "xx.xx.xx.xx",
"clientPort": 19580,
"cpuTime": 1949.68,
"dbName": "test11",
"decodeTime": 0.0,
"diskReads": 0.0,
"elapsedTime": 1956.43,
"executeTime": 1949.66,
"executorRpc": false,
"expectedWorkerCount": 0,
"fullSqlText": "select * from high_disk_read_2 where id > -4413621632286266099 order by id desc limit 1",
"getPlanTime": 0.03,
"hitPlan": true,
"inner": false,
"memstoreReadRows": 0,
"netTime": 0.0,
"netWaitTime": 0.0,
"partitionCount": 1,
"planId": 1049,
"planType": "LOCAL",
"queueTime": 6.75,
"requestId": 369604,
"requestTime": "2025-12-23T06:47:06.207Z",
"retCode": 0,
"retryCount": 0,
"returnRows": 1,
"rowCacheHit": 0.0,
"rpcCount": 0,
"server": "xxx.xxx.x.xxx:xxxx",
"sqlId": "5D51DC02208F9A448157FD8A********",
"sqlTextShort": "select * from high_disk_read_2 where id > ? order by id desc limit ?",
"sqlType": "SELECT",
"ssstoreReadRows": 525,
"tableScan": true,
"traceId": "YB420A7100C3-00064694CC824665-0-0",
"transHash": "0",
"usedWorkerCount": 0,
"userClientIp": "xx.xx.xx.xx",
"userName": "test11",
"waitCount": 0,
"waitEvent": "event:, p1text:, p1:0, p2text:, p2:0, p3text:, p3:0"
}
]
},
"requestId": "4c437bbe-d404-4b7a-afcb-88749e4d47a2",
"success": true
}