Retrieves optimization suggestions for a data change or SQL review ticket.
Operation description
For more information about the SQL review feature, see SQL review.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
dms:GetSQLReviewOptimizeDetail |
get |
*All Resource
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| SQLReviewQueryKey |
string |
Yes |
The key that is used to query the details of optimization suggestions. You can call the ListSQLReviewOriginSQL operation to query the key. |
a57e54ec5433475ea3082d882fdb**** |
| Tid |
integer |
No |
The ID of the tenant. You can call the GetUserActiveTenant or ListUserTenants operation to query the ID of the tenant. |
1 |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
|||
| RequestId |
string |
The ID of the request. |
0C1CB646-1DE4-4AD0-B4A4-7D47DD52E931 |
| ErrorCode |
string |
The error code returned. |
UnknownError |
| ErrorMessage |
string |
The error message returned. |
UnknownError |
| Success |
boolean |
Indicates whether the request is successful. |
true |
| OptimizeDetail |
object |
The details of optimization suggestions for SQL statements. |
|
| QueryKey |
string |
The key that is used to query the details of optimization suggestions. |
a57e54ec5433475ea3082d882fdb**** |
| InstanceId |
integer |
The ID of the instance to which the database belongs. |
123321 |
| DbId |
integer |
The ID of the database. |
111222 |
| SqlType |
string |
The type of the SQL statement. Valid values: DELETE, UPDATE, and ALTER_TABLE. |
UPDATE |
| QualityResult |
object |
The quality of the SQL statement. |
|
| ErrorMessage |
string |
The error message returned. |
syntax error |
| Results |
array<object> |
The review results based on rules. |
|
|
array<object> |
|||
| RuleName |
string |
The name of the rule. For more information, see SQL review optimization. |
SELECT_SUGGEST_ASSIGN_WHERE |
| Feedback |
string |
The optimization suggestion for the SQL statement. Valid values:
|
MUST_IMPROVE |
| Comments |
string |
The comment that is specified when you create the SQL review rule. For more information, see SQL review optimization. |
xxx业务规定:查询必须带where条件 |
| Messages |
array |
The review results. |
|
|
string |
audit information. |
xxx表不存在 |
|
| Scripts |
array<object> |
The SQL script for data changes. |
|
|
object |
|||
| OpType |
string |
The purpose of the SQL script. The value is set to AddIndex. |
AddIndex |
| Content |
string |
The content of the SQL script. |
alter table xxx add index idx_xx(yyy); |
| TableName |
string |
The name of the table. |
xxx |
| RuleType |
string |
The type of the SQL review rule. Valid values:
|
REVIEW |
| OccurError |
boolean |
Indicates whether an error occurs. Valid values:
|
false |
Examples
Success response
JSON format
{
"RequestId": "0C1CB646-1DE4-4AD0-B4A4-7D47DD52E931",
"ErrorCode": "UnknownError",
"ErrorMessage": "UnknownError",
"Success": true,
"OptimizeDetail": {
"QueryKey": "a57e54ec5433475ea3082d882fdb****",
"InstanceId": 123321,
"DbId": 111222,
"SqlType": "UPDATE",
"QualityResult": {
"ErrorMessage": "syntax error",
"Results": [
{
"RuleName": "SELECT_SUGGEST_ASSIGN_WHERE",
"Feedback": "MUST_IMPROVE",
"Comments": "xxx业务规定:查询必须带where条件",
"Messages": [
"xxx表不存在"
],
"Scripts": [
{
"OpType": "AddIndex",
"Content": "alter table xxx add index idx_xx(yyy);",
"TableName": "xxx"
}
],
"RuleType": "REVIEW"
}
],
"OccurError": false
}
}
}
Error codes
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.