Queries SQL templates that failed to be executed.
- If you use an Alibaba Cloud SDK or a 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 is applicable to the following database services:
- ApsaraDB RDS for MySQL
- PolarDB for MySQL
- ApsaraDB RDS for PostgreSQL
Request parameters
| Parameter | Type | Required | Example | Description |
|---|---|---|---|---|
| Action | String | Yes | GetQueryOptimizeExecErrorStats | The operation that you want to perform. Set the value to GetQueryOptimizeExecErrorStats. |
| Engine | String | Yes | MySQL | The database engine. Valid values:
|
| InstanceIds | String | No | rm-2ze8g2am97624**** | The instance IDs. Separate multiple IDs with commas (,). |
| Keywords | String | No | select update | The keywords of the SQL templates. Separate multiple keywords with spaces. |
| LogicalOperator | String | No | or | The logical relationship between multiple keywords. Valid values:
|
| DbNames | String | No | testdb01 | The name of the database to be queried. |
| Time | String | Yes | 1642953600000 | The end of the time range to query. Specify the time in the UNIX timestamp format. Unit: milliseconds. |
| PageSize | String | Yes | 10 | The number of entries to return on each page. Default value: 10. |
| PageNo | String | Yes | 1 | The number of the page to return. Pages start from page 1. Default value: 1. |
| OrderBy | String | No | error_count | The field by which to sort the returned entries. Only error_count is supported, which indicates that the entries are sorted based on the number of failed executions. |
| Asc | String | No | true | Specifies whether to sort the returned entries in ascending order. Default value: true. Valid values:
|
| Region | String | No | cn-china | The region in which the instance resides. Valid values:
This parameter is valid only if the InstanceIds parameter is left empty. If you do not specify the InstanceIds parameter, the system obtains data from the region set by the Region parameter. By default, the Region parameter is set to cn-china. If you have specified the InstanceIds parameter, the specified Region parameter becomes invalid and the system obtains data from the region in which the first specified instance resides. Note If your instances reside in the regions inside the Chinese mainland, set this parameter to cn-china. |
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 detailed information, including the error codes and the number of entries that are returned. | |
| Total | Long | 19 | The total number of returned entries. |
| PageNo | Integer | 1 | The page number of the returned page. |
| PageSize | Integer | 10 | The number of entries returned on each page. |
| Extra | String | None | A reserved parameter. |
| List | Array of QueryOptimizeExecErrorStats | The information about the SQL templates that failed to execute. | |
| InstanceId | String | rm-2ze8g2am97624**** | The ID of the instance. |
| InstanceName | String | test01 | The alias of the instance. |
| Dbname | String | testdb01 | The name of the database. |
| SqlId | String | 2e8147b5ca2dfc640dfd5e43d96a**** | The ID of the SQL template. |
| SqlText | String | select * from test1 | The content of the SQL template. |
| ErrorCode | String | 1146 | The error code returned. |
| ErrorCount | Long | 10 | The number of errors. |
| RequestId | String | B6D17591-B48B-4D31-9CD6-9B9796B2**** | The ID of the request. |
| Success | String | true | Indicates whether the request was successful. Valid values:
|
Examples
Sample requests
http(s)://das.cn-shanghai.aliyuncs.com/?Action=GetQueryOptimizeExecErrorStats
&Engine=MySQL
&InstanceIds=rm-2ze8g2am97624****
&Keywords=select update
&LogicalOperator=or
&DbNames=testdb01
&Time=1642953600000
&PageSize=10
&PageNo=1
&OrderBy=error_count
&Asc=true
&Region=cn-china
&Common request parametersSample success responses
XML format
HTTP/1.1 200 OK
Content-Type:application/xml
<GetQueryOptimizeExecErrorStatsResponse>
<Code>200</Code>
<Message>Successful</Message>
<Data>
<Total>19</Total>
<PageNo>1</PageNo>
<PageSize>10</PageSize>
<Extra>None</Extra>
<List>
<InstanceId>rm-2ze8g2am97624****</InstanceId>
<InstanceName>test01</InstanceName>
<Dbname>testdb01</Dbname>
<SqlId>2e8147b5ca2dfc640dfd5e43d96a****</SqlId>
<SqlText>select * from test1</SqlText>
<ErrorCode>1146</ErrorCode>
<ErrorCount>10</ErrorCount>
</List>
</Data>
<RequestId>B6D17591-B48B-4D31-9CD6-9B9796B2****</RequestId>
<Success>true</Success>
</GetQueryOptimizeExecErrorStatsResponse>JSON format
HTTP/1.1 200 OK
Content-Type:application/json
{
"Code" : "200",
"Message" : "Successful",
"Data" : {
"Total" : 19,
"PageNo" : 1,
"PageSize" : 10,
"Extra" : "None",
"List" : [ {
"InstanceId" : "rm-2ze8g2am97624****",
"InstanceName" : "test01",
"Dbname" : "testdb01",
"SqlId" : "2e8147b5ca2dfc640dfd5e43d96a****",
"SqlText" : "select * from test1",
"ErrorCode" : "1146",
"ErrorCount" : 10
} ]
},
"RequestId" : "B6D17591-B48B-4D31-9CD6-9B9796B2****",
"Success" : "true"
}Error codes
| HTTP status code | Error code | Error message | Description |
|---|---|---|---|
| 400 | InvalidParams | The request parameters are invalid. | The error message returned because the specified request parameters are invalid. |
For a list of error codes, see Service error codes.