Obtains the failed SQL statements under a specified SQL template.

Before you call this operation, make sure that the following requirements are met:

  • 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 can be used in 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 GetQueryOptimizeExecErrorSample

The operation that you want to perform. Set the value to GetQueryOptimizeExecErrorSample.

Engine String Yes MySQL

The database engine. Valid values:

  • MySQL
  • PolarDBMySQL
  • PostgreSQL
InstanceId String Yes rm-2ze8g2am97624****

The ID of the instance.

SqlId String Yes 2e8147b5ca2dfc640dfd5e43d96a****

The ID of the SQL template. You can call the GetQueryOptimizeExecErrorStats operation to obtain the SQL template ID.

Time String Yes 1642953600000

The date to query. Specify the date in the UNIX timestamp format. Unit: milliseconds.

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

Details of the returned entries.

Total Long 2

The total number of returned entries.

PageNo Integer None

A reserved parameter.

PageSize Integer None

A reserved parameter.

Extra String None

A reserved parameter.

List Array of QueryOptimizeExecErrorSamples
OrigHost String 100.104.XX.XX

The IP address of the client that executes the SQL statement.

User String test01

The username of the client that executes the SQL statement.

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.

Timestamp Long 1643020306739

The time when the SQL statement is executed. The time is in the UNIX timestamp format. Unit: milliseconds.

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


Sample requests

&Common request parameters

Sample success responses

XML format

HTTP/1.1 200 OK

            <SqlText>select * from test1</SqlText>

JSON format

HTTP/1.1 200 OK

  "Code" : "200",
  "Message" : "Successful",
  "Data" : {
    "Total" : 2,
    "Extra" : "None",
    "List" : [ {
      "OrigHost" : "100.104.XX.XX",
      "User" : "test01",
      "Dbname" : "testdb01",
      "SqlId" : "2e8147b5ca2dfc640dfd5e43d96a****",
      "SqlText" : "select * from test1",
      "ErrorCode" : "1146",
      "Timestamp" : 1643020306739
    } ]
  "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.