获取慢SQL说明
更新时间:2023-08-23
接口说明
获取慢SQL说明
请求结构
Plain Text
1GET /v{version}/instance/{instanceId}/smartdba/slowsql/explain/{sqlId}/{schema} HTTP/1.1
2HOST: rds.bj.baidubce.com
3Content-Type: application/json
4Authorization: authorization string
请求头域
除公共头域外,无其它特殊头域。
请求参数
参数名称 | 类型 | 是否必选 | 参数位置 | 描述 |
---|---|---|---|---|
version | Integer | 是 | URL参数 | API 版本号 |
instanceId | String | 是 | URL参数 | 实例ID |
schema | Long | 否 | URL参数 | 数据库名称 |
sqlId | Long | 否 | URL参数 | SQL标识ID |
返回头域
除公共头域,无其它特殊头域。
返回参数
参数名称 | 类型 | 描述 |
---|---|---|
list | List<SlowsqlExplainResponse> | SQL记录的列表 |
SlowsqlExplainResponse字段数据结构说明
参数名称 | 类型 | 描述 |
---|---|---|
explainId | Long | SELECT标识符,这是查询中SELECT的序列号 |
extra | String | 此列包含有关MySQL如何解析查询的其他信息。 |
filtered | Double | 按表条件筛选的表行的估计百分比 |
key | String | MySQL实际决定使用的键(索引) |
keyLen | String | MySQL决定使用的密钥的长度 |
partitions | String | 匹配的分区 |
possibleKeys | String | MySQL可以从中选择查找该表中的行的索引 |
ref | String | 将哪些列或常量与键列中命名的索引进行比较,以便从表中选择行 |
rows | Long | MySQL认为执行查询必须检查的行数 |
selectType | String | SELECT的类型 |
table | String | 表名 |
type | String | 连接类型 |
请求示例
Plain Text
1GET /v1/instance/rds-xXE6pdR1/smartdba/slowsql/explain/189e8943-51d4-4f43-9df9-576a6c1056f9/db1 HTTP/1.1
2HOST: rds.bj.baidubce.com
3Content-Type: application/json
4Authorization: bce-auth-v1/f81d3b34e48048fbb2634dc7882d7e21/2017-11-21T04:17:29Z/3600/host/74c506f68c65e26c633bfa104c863fffac5190fdec1ec24b7c03eb5d67d2e1de
返回示例
Plain Text
1HTTP/1.1 200 OK
2Content-Type: application/json
3x-bce-request-id: d8752367-38e8-45e4-b4c7-e53be3137ce5
4Server: BWS
5{
6 "list": [
7 {
8 "explainId": 1,
9 "extra": "",
10 "filtered": 100,
11 "key": "",
12 "keyLen": "",
13 "partitions": "",
14 "possibleKeys": "",
15 "ref": "",
16 "rows": 3,
17 "selectType": "SIMPLE",
18 "table": "tb1",
19 "type": "ALL"
20 }
21 ]
22}