Queries SQL templates that failed to execute.

Usage notes

  • If you use an Alibaba Cloud SDK, make sure that the aliyun-sdk-core version is later than V2.1.8. We recommend that you use the latest version.
  • The version of your Database Autonomy Service (DAS) SDK must be V2.1.8 or later.
  • If you use an SDK to call the DAS service, you must set the region to cn-shanghai.
  • This operation supports 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:

  • MySQL
  • PolarDBMySQL
  • PostgreSQL
InstanceIds String No rm-2ze8g2am97624****

The ID of the instance. 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:

  • or
  • and
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 filed 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:

  • true
  • false

Response parameters

Parameter Type Example Description
Code String 200

The returned HTTP status code.

Message String Successful

The message that is returned for the request.

Data Object

The detailed information, including the error codes and the number of error messages.

Total Long 19

The total number of entries returned.

PageNo Integer 1

The page number of the returned page.

PageSize Integer 10

The number of entries returned per page.

Extra String None

A reserved parameter.

List Array of QueryOptimizeExecErrorStats

The list of SQL templates that failed to execute.

InstanceId String rm-2ze8g2am97624****

The ID of the instance.

InstanceName String Test instance

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.

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 is successful. Valid values:

  • true
  • false

Examples

Sample requests

http(s)://das.cn-shanghai.aliyuncs.com/?Action=GetQueryOptimizeExecErrorStats
&Engine=MySQL
&InstanceIds=rm-2ze8g2am97624****
&Keywords=select update
&LogicalOperator=or
&DbNames=test
&Time=1642953600000
&PageSize=1
&PageNo=10
&OrderBy=error_count
&Asc=true
&Common request parameters

Sample 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>
        <List>
            <InstanceId>rm-2ze8g2am97624****</InstanceId>
            <InstanceName>Test instance</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,
    "List" : {
      "InstanceId" : "rm-2ze8g2am97624****",
      "InstanceName" : "Test instance",
      "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, visit the API Error Center.