DescribeBadSqlDetection - 查看BadSQL
查看一段时间范围内影响实例稳定的BadSQL。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
调试
授权信息
|
操作 |
访问级别 |
资源类型 |
条件关键字 |
关联操作 |
|
adb:DescribeBadSqlDetection |
get |
DBCluster
|
无 | 无 |
请求参数
|
名称 |
类型 |
必填 |
描述 |
示例值 |
| DBClusterId |
string |
是 |
集群 ID。 说明
您可以通过 DescribeDBClusters 接口查询账号下所有集群的信息详情。 |
am-xxx |
| RegionId |
string |
是 |
地域 ID。 说明
您可以调用 DescribeRegions 接口查看指定 AnalyticDB MySQL 数仓版集群的地域 ID。 |
cn-hangzhou |
| StartTime |
string |
否 |
查询开始时间,格式为 yyyy-MM-ddTHH:mm:ssZ(UTC 时间)。 |
2021-05-18T06:00:00Z |
| EndTime |
string |
否 |
查询结束时间,需要大于查询开始时间。格式:yyyy-MM-ddTHH:mmZ(UTC 时间)。 |
2021-09-30T00:15Z |
| Lang |
string |
否 |
语言配置,取值说明:
|
zh |
返回参数
|
名称 |
类型 |
描述 |
示例值 |
|
object |
|||
| TotalCount |
string |
总记录数。 |
5 |
| RequestId |
string |
请求 ID。 |
32C6E870-81E5-5E2A-BE7D-F9623F090DAB |
| DBClusterId |
string |
集群 ID。 |
am-xxx |
| DetectionItems |
array<object> |
检测项及检测结果列表。 |
|
|
array<object> |
|||
| Name |
string |
检测项。 |
PeakMemory OperatorCost ScanSize |
| Results |
array<object> |
检测项的检测结果。 |
|
|
array<object> |
检测结果对象。 |
||
| Cost |
integer |
查询的总耗时。单位:毫秒。 说明
该耗时指标是 |
37 |
| PeakMemory |
integer |
查询的峰值内存。 |
1234 |
| OperatorCost |
integer |
该阶段内部总的算子耗时,等同于该阶段的 CPU Time,可用于判断查询哪些部分消耗了较多的计算资源。单位为毫秒(ms)。 |
12345 |
| ScanSize |
integer |
扫描数据量,单位:Byte。 |
1234 |
| OutputDataSize |
integer |
返回数据量,单位:Byte。 |
1234 |
| ProcessId |
string |
查询 ID。 |
2023120808405202104101604703151654257 |
| TotalStages |
integer |
查询生成的总 Stage 数量。 |
123 |
| DiagnosisResults |
array<object> |
BadSQL 查询诊断结果。 |
|
|
object |
|||
| Code |
string |
诊断码。 |
FILTER_NOT_PUSHDOWN |
| Detail |
string |
查询诊断结果详情。 |
The query consumes a large amount of memory resources. Perform memory optimization for the query. |
| StageId |
string |
StageID。 |
Stage[1] |
| OperatorId |
string |
算子 ID。 |
Join[234] |
| SQL |
string |
SQL 语句详情。 说明
出于性能考虑,当前 SQL 语句最长支持显示 5120 个字符,超出限制的 SQL 语句会被截断。您可以调用 DownloadDiagnosisRecords 接口下载符合指定条件的 SQL 语句的摘要信息,包括完整的 SQL 语句。 |
select * from user |
| PatternId |
string |
SQL Pattern 的 ID。 |
-5978869478527645300 |
| StartTime |
string |
查询开始时间。格式:yyyy-MM-ddTHH:mmZ(UTC 时间)。 |
2024-05-05T02:13Z |
| Status |
string |
检测结果状态。 |
NORMAL WARNNING CRITICAL |
| Message |
string |
诊断结果信息。 |
Multiple bad SQL statements are detected. Perform optimization on the statements. |
| AccessDeniedDetail |
string |
访问被拒绝详细信息。 |
{ "PolicyType": "AccountLevelIdentityBasedPolicy", "AuthPrincipalOwnerId": "1*****************7", "EncodedDiagnosticMessage": "AQIBIAAAAOPdwKY2QLOvgMEc7SkkoJfj1kvZwsaRqNYMh10Tv0wTe0fCzaCdrvgazfNb0EnJKETgXyhR+3BIQjx9WAqZryejBsp1Bl4qI5En/D9dEhcXAtKCxCmE2kZCiEzpy8BoEUt+bs0DmlaGWO5xkEpttypLIB4rUhDvZd+zwPg4EXk4KSSWSWsurxtqDkKEMshKlQFBTKvJcKwyhk62IeYly4hQ+5IpXjkh1GQXuDRCQ==", "AuthPrincipalType": "SubUser", "AuthPrincipalDisplayName": "2***************9", "NoPermissionType": "ImplicitDeny", "AuthAction": "adb:DescribeExcessivePrimaryKeys" } |
示例
正常返回示例
JSON格式
{
"TotalCount": "5",
"RequestId": "32C6E870-81E5-5E2A-BE7D-F9623F090DAB",
"DBClusterId": "am-xxx",
"DetectionItems": [
{
"Name": "PeakMemory\nOperatorCost\nScanSize",
"Results": [
{
"Cost": 37,
"PeakMemory": 1234,
"OperatorCost": 12345,
"ScanSize": 1234,
"OutputDataSize": 1234,
"ProcessId": "2023120808405202104101604703151654257",
"TotalStages": 123,
"DiagnosisResults": [
{
"Code": "FILTER_NOT_PUSHDOWN",
"Detail": "The query consumes a large amount of memory resources. Perform memory optimization for the query.",
"StageId": "Stage[1]",
"OperatorId": "Join[234]"
}
],
"SQL": "select * from user",
"PatternId": "-5978869478527645300",
"StartTime": "2024-05-05T02:13Z"
}
],
"Status": "NORMAL\nWARNNING\nCRITICAL",
"Message": "Multiple bad SQL statements are detected. Perform optimization on the statements."
}
],
"AccessDeniedDetail": "{\n \"PolicyType\": \"AccountLevelIdentityBasedPolicy\",\n \"AuthPrincipalOwnerId\": \"1*****************7\",\n \"EncodedDiagnosticMessage\": \"AQIBIAAAAOPdwKY2QLOvgMEc7SkkoJfj1kvZwsaRqNYMh10Tv0wTe0fCzaCdrvgazfNb0EnJKETgXyhR+3BIQjx9WAqZryejBsp1Bl4qI5En/D9dEhcXAtKCxCmE2kZCiEzpy8BoEUt+bs0DmlaGWO5xkEpttypLIB4rUhDvZd+zwPg4EXk4KSSWSWsurxtqDkKEMshKlQFBTKvJcKwyhk62IeYly4hQ+5IpXjkh1GQXuDRCQ==\",\n \"AuthPrincipalType\": \"SubUser\",\n \"AuthPrincipalDisplayName\": \"2***************9\",\n \"NoPermissionType\": \"ImplicitDeny\",\n \"AuthAction\": \"adb:DescribeExcessivePrimaryKeys\"\n}"
}
错误码
|
HTTP status code |
错误码 |
错误信息 |
描述 |
|---|---|---|---|
| 404 | InvalidDBCluster.NotFound | The DBClusterId provided does not exist in our records. | 您指定的 DBClusterId 不存在,请确认 DBClusterId 值是否正确。 |
访问错误中心查看更多错误码。
变更历史
更多信息,参考变更详情。