Queries bad SQL statements that affect cluster stability within a specified time range.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
adb:DescribeBadSqlDetection |
get |
DBCluster
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| DBClusterId |
string |
Yes |
The cluster ID. Note
You can call the DescribeDBClusters operation to query the information about all AnalyticDB for MySQL clusters within a region, including cluster IDs. |
am-xxx |
| RegionId |
string |
Yes |
The region ID. Note
You can call the DescribeRegions operation to query the most recent region list. |
cn-hangzhou |
| StartTime |
string |
No |
The beginning of the time range to query. Specify the time in the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time is in UTC. |
2021-05-18T06:00:00Z |
| EndTime |
string |
No |
The end of the time range to query. The end time must be later than the start time. Specify the time in the yyyy-MM-ddTHH:mmZ format. The time is in UTC. |
2021-09-30T00:15Z |
| Lang |
string |
No |
The language. Valid values:
|
zh |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
The response parameters. |
||
| TotalCount |
string |
The total number of entries returned. |
5 |
| RequestId |
string |
The request ID. |
32C6E870-81E5-5E2A-BE7D-F9623F090DAB |
| DBClusterId |
string |
The cluster ID. |
am-xxx |
| DetectionItems |
array<object> |
The detection results. |
|
|
array<object> |
The detection result. |
||
| Name |
string |
The name of the detection item. |
PeakMemory OperatorCost ScanSize |
| Results |
array<object> |
The detection results. |
|
|
array<object> |
The detection result. |
||
| Cost |
integer |
The total execution duration. Unit: milliseconds. Note
This value is the cumulative value of the |
37 |
| PeakMemory |
integer |
The peak memory usage. |
1234 |
| OperatorCost |
integer |
The total CPU time consumed by all operators in the stage, which is equivalent to the total CPU time of the stage. Use this parameter to identify which parts of the stage consume a large amount of computing resources. Unit: milliseconds. |
12345 |
| ScanSize |
integer |
The amount of scanned data. Unit: bytes. |
1234 |
| OutputDataSize |
integer |
The amount of returned data. Unit: bytes. |
1234 |
| ProcessId |
string |
The query ID. |
2023120808405202104101604703151654257 |
| TotalStages |
integer |
The total number of stages generated. |
123 |
| DiagnosisResults |
array<object> |
The diagnostic results. |
|
|
object |
The diagnostic result. |
||
| Code |
string |
The diagnostic code. |
FILTER_NOT_PUSHDOWN |
| Detail |
string |
The diagnostic result details. |
queryconsumed a lot ofmemoryresource,Please performquerymemoryoptimization |
| StageId |
string |
The stage ID. |
Stage[1] |
| OperatorId |
string |
The operator ID. |
Join[234] |
| SQL |
string |
The SQL statement. Note
For performance reasons, SQL statements longer than 5,120 characters are truncated. To download complete SQL statements that meet a query condition, call the DownloadDiagnosisRecords operation. |
select * from user |
| PatternId |
string |
The SQL pattern ID. |
-5978869478527645300 |
| StartTime |
string |
The start time of the query. The time follows the ISO 8601 standard in the yyyy-MM-ddTHH:mmZ format. The time is in UTC. |
2024-05-05T02:13Z |
| Status |
string |
The severity level of the detection result. Valid values: |
NORMAL WARNNING CRITICAL |
| Message |
string |
The diagnostic result details. |
DetectedmultipleBadSQL,please optimize |
| AccessDeniedDetail |
string |
The access denial details. |
{ "PolicyType": "AccountLevelIdentityBasedPolicy", "AuthPrincipalOwnerId": "1*****************7", "EncodedDiagnosticMessage": "AQIBIAAAAOPdwKY2QLOvgMEc7SkkoJfj1kvZwsaRqNYMh10Tv0wTe0fCzaCdrvgazfNb0EnJKETgXyhR+3BIQjx9WAqZryejBsp1Bl4qI5En/D9dEhcXAtKCxCmE2kZCiEzpy8BoEUt+bs0DmlaGWO5xkEpttypLIB4rUhDvZd+zwPg4EXk4KSSWSWsurxtqDkKEMshKlQFBTKvJcKwyhk62IeYly4hQ+5IpXjkh1GQXuDRCQ==", "AuthPrincipalType": "SubUser", "AuthPrincipalDisplayName": "2***************9", "NoPermissionType": "ImplicitDeny", "AuthAction": "adb:DescribeExcessivePrimaryKeys" } |
Examples
Success response
JSON format
{
"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": "queryconsumed a lot ofmemoryresource,Please performquerymemoryoptimization",
"StageId": "Stage[1]",
"OperatorId": "Join[234]"
}
],
"SQL": "select * from user",
"PatternId": "-5978869478527645300",
"StartTime": "2024-05-05T02:13Z"
}
],
"Status": "NORMAL\nWARNNING\nCRITICAL",
"Message": "DetectedmultipleBadSQL,please optimize"
}
],
"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}"
}
Error codes
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 404 | InvalidDBCluster.NotFound | The DBClusterId provided does not exist in our records. | The specified DBClusterId parameter does not exist. Make sure that the DBClusterId value is valid. |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.