Queries suggestions provided by query governance for optimizing an SQL template.
- If you use Alibaba Cloud SDK or Database Autonomy Service (DAS) SDK to call this API operation, we recommend that you use the latest version of the SDK.
- If you use an SDK to call API operations of DAS, you must set the region ID to cn-shanghai.
- This operation supports the following database engines:
- ApsaraDB RDS for MySQL
- PolarDB for MySQL
- ApsaraDB RDS for PostgreSQL
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | Yes | GetQueryOptimizeSolution | The operation that you want to perform. Set the value to GetQueryOptimizeSolution. |
Engine | String | Yes | MySQL | The database engine. Valid values:
|
SqlId | String | Yes | 05fecf7e7b3efd123c4d5197035f**** | The SQL template ID. You can call the GetQueryOptimizeDataStats operation to query the SQL template ID. |
RuleIds | String | Yes | LARGE_ROWS_EXAMINED | The tag IDs. For more information, see Query governance. |
InstanceId | String | No | rm-bp1o3z6beqpej**** | The instance ID. You can call the GetQueryOptimizeDataStats operation to query the instance ID. |
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
Code | String | 200 | The HTTP status code returned. |
Message | String | Successful | The message that is returned for the request. |
Data | Object | The details of the optimization suggestions. |
|
Total | Long | 1 | The total number of entries returned. |
PageNo | Integer | None | The reserved parameter. |
PageSize | Integer | None | The reserved parameter. |
Extra | String | None | The reserved parameter. |
List | Array of QueryOptimizeSolutions | The list of optimization suggestions. |
|
Level | String | INFO | The severity level. Valid values:
|
RuleId | String | LARGE_ROWS_EXAMINED | The tag ID. For more information, see Query governance. |
Solution | String | LARGE_ROWS_EXAMINED_SOLUTION | The suggestion. For more information, see Query governance. |
SolutionExt | String | None | The reserved parameter. |
RequestId | String | 30FF4E40-17F3-5A51-AB23-43F30D9B**** | The request ID. |
Success | String | true | Indicates whether the request was successful. Valid values:
|
Examples
Sample requests
http(s)://das.cn-shanghai.aliyuncs.com/?Action=GetQueryOptimizeSolution
&Engine=MySQL
&SqlId=05fecf7e7b3efd123c4d5197035f****
&RuleIds=LARGE_ROWS_EXAMINED
&Common request parameters
Sample success responses
XML
format
HTTP/1.1 200 OK
Content-Type:application/xml
<GetQueryOptimizeSolutionResponse>
<Code>200</Code>
<Message>Successful</Message>
<Data>
<Total>1</Total>
<Extra>None</Extra>
<List>
<Level>INFO</Level>
<RuleId>LARGE_ROWS_EXAMINED</RuleId>
<Solution>LARGE_ROWS_EXAMINED_SOLUTION</Solution>
<SolutionExt>None</SolutionExt>
</List>
</Data>
<RequestId>30FF4E40-17F3-5A51-AB23-43F30D9B****</RequestId>
<Success>true</Success>
</GetQueryOptimizeSolutionResponse>
JSON
format
HTTP/1.1 200 OK
Content-Type:application/json
{
"Code" : "200",
"Message" : "Successful",
"Data" : {
"Total" : 1,
"Extra" : "None",
"List" : [ {
"Level" : "INFO",
"RuleId" : "LARGE_ROWS_EXAMINED",
"Solution" : "LARGE_ROWS_EXAMINED_SOLUTION",
"SolutionExt" : "None"
} ]
},
"RequestId" : "30FF4E40-17F3-5A51-AB23-43F30D9B****",
"Success" : "true"
}
Error codes
HTTP status code | Error code | Error message | Description |
---|---|---|---|
400 | InvalidParams | The request parameters are invalid. | Invalid request parameters. |
For a list of error codes, see Service error codes.