Displays SQL diagnostic history on multiple pages.

Request parameters

Parameter Type Required Example Description
Action String Yes GetRequestDiagnosisPage

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

InstanceId String No rm-0iwhhl8gx0ld6****

The ID of the instance.

NodeId String No 202****

The ID of the node.

Note This parameter is required for cluster instances that run engines such as MongoDB.
PageNo Integer No 1

The number of the page to return. The value must be an integer that is greater than 0. Default value: 1.

PageSize Integer No 10

The maximum number of entries to return on each page. The value must be an integer that is greater than 0. Default value: 10.

StartTime Long No 1633071840000

The beginning of the time range to query. Specify the time in the UNIX timestamp format. Unit: milliseconds.

EndTime Long No 1634972640000

The end of the time range to query. Specify the time in the UNIX timestamp format. Unit: milliseconds.

Response parameters

Parameter Type Example Description
Message String Successful

The message that is returned for the request.

Note If the request is successful, Successful is returned. If the request fails, an error message that contains information such as an error code is returned.
RequestId String 800FBAF5-A539-5B97-A09E-C63AB2F7****

The ID of the request.

Data Object

The returned data.

list Array of T

The SQL diagnostic records.

messageId String 61820b594664275c4429****

The unique ID of the diagnostic task.

uuid String hdm_51fe9bc19ec413f4d530431af87a****

The unique ID of the diagnostic instance.

accountId String 2093****

The ID of the user.

sqlId String 0c95dae3afef77be06572612df9b****

The ID of the SQL template.

engine String MySQL

The database engine. Valid values:

  • MongoDB
  • MySQL
  • PolarDBOracle
  • PSQLServer
dbSchema String das

The name of the database.

param String {"":""}

The additional information.

state Integer 2

The diagnostic status. Valid values:

  • 0: The diagnostic task is in progress.
  • 1: A diagnostic error occurred.
  • 2: The diagnostic task is completed.
  • 3: An SQL error occurred.
  • 4: An engine error occurred.
result String { "endTime":1636354256000, "errorCode":"0001", "errorMessage":"TFX succeeded", "estimateCost":{ "cpu":1.7878745150389268, "io":9.948402604746128, "rows":8.889372575194633 }, "improvement":12933.97, "indexAdvices":[ { "columns":[ "work_no" ], "ddlAddIndex":"ALTER TABLE `test`.`work_order` ADD INDEX `idx_workno` (`work_no`)", "indexName":"idx_workno", "schemaName":"test", "tableName":"work_order", "unique":false } ], "ip":"****.mysql.rds.aliyuncs.com", "messageId":"6188c8cb2f1365b16aee****", "port":3306, "sqlTag":"{\"PRED_EQUAL\":\"Y\",\"CNT_QB\":\"1\",\"CNT_TB\":\"1\"}", "startTime":1636354252000, "success":true, "support":true, "tuningAdvices":[ ] }

The SQL diagnostic result, which includes the following information:

  • endTime: the end time of the SQL diagnostic task.
  • errorCode: the error code.
  • ErrorMessage: the error message.
  • estimateCost: the estimated cost.
    • cpu: the estimated CPU utilization by the index.
    • io: the estimated I/O usage by the index.
    • rows: the estimated values of the columns for the index.
  • improvement: the performance improvement ratio.
  • indexAdvices: the index recommendations.
    • columns: the index columns.
    • ddlAddIndex: the DDL statement for the index.
    • indexName: the name of the index.
    • schemaName: the name of the database.
    • tableName: the name of the table.
    • unique: indicates whether the index is unique.
  • ip: the IP address of the instance.
  • messageId: the ID of the diagnostic task.
  • port: the port used to connect to the instance.
  • sqlTag: the SQL tag.
  • startTime: the start time of the SQL diagnostic task.
  • success: indicates whether the request is successful.
  • support: the diagnostic support level.
  • tuningAdvices: the SQL optimization suggestions.
gmtCreate String 1633071840000

The time when the SQL diagnostic task was created. This value is a UNIX timestamp. Unit: milliseconds.

gmtModified String 1633071850000

The time when the SQL diagnostic task was modified. This value is a UNIX timestamp. Unit: milliseconds.

pageNo Long 1

The page number of the returned page. The value must be an integer that is greater than 0. Default value: 1.

pageSize Long 10

The number of entries returned per page. The value must be an integer that is greater than 0. Default value: 10.

total Long 100

The total number of returned entries.

extra String {"":""}

The additional information.

Code String 200

The HTTP status code.

Success String true

Indicates whether the request is successful. Valid values:

  • true
  • false

Examples

Sample requests

http(s)://das.cn-shanghai.aliyuncs.com/?Action=GetRequestDiagnosisPage
&InstanceId=rm-0iwhhl8gx0ld6****
&NodeId=202****
&PageNo=1
&PageSize=10
&StartTime=1633071840000
&EndTime=1634972640000
&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<GetRequestDiagnosisPageResponse>
    <Message>Successful</Message>
    <RequestId>800FBAF5-A539-5B97-A09E-C63AB2F7****</RequestId>
    <Data>
        <list>
            <messageId>61820b594664275c4429****</messageId>
            <uuid>hdm_51fe9bc19ec413f4d530431af87a****</uuid>
            <accountId>2093****</accountId>
            <sqlId>0c95dae3afef77be06572612df9b****</sqlId>
            <engine>MySQL</engine>
            <dbSchema>das</dbSchema>
            <param>{"":""}</param>
            <state>2</state>
            <result>{     "endTime":1636354256000,     "errorCode":"0001",     "errorMessage":"TFX succeeded",     "estimateCost":{         "cpu":1.7878745150389268,         "io":9.948402604746128,         "rows":8.889372575194633     },     "improvement":12933.97,     "indexAdvices":[         {             "columns":[                 "work_no"             ],             "ddlAddIndex":"ALTER TABLE `test`.`work_order` ADD INDEX `idx_workno` (`work_no`)",             "indexName":"idx_workno",             "schemaName":"test",             "tableName":"work_order",             "unique":false         }     ],     "ip":"****.mysql.rds.aliyuncs.com",     "messageId":"6188c8cb2f1365b16aee****",     "port":3306,     "sqlTag":"{\"PRED_EQUAL\":\"Y\",\"CNT_QB\":\"1\",\"CNT_TB\":\"1\"}",     "startTime":1636354252000,     "success":true,     "support":true,     "tuningAdvices":[      ] }</result>
            <gmtCreate>1633071840000</gmtCreate>
            <gmtModified>1633071850000</gmtModified>
        </list>
        <pageNo>1</pageNo>
        <pageSize>10</pageSize>
        <total>100</total>
        <extra>{"":""}</extra>
    </Data>
    <Code>200</Code>
    <Success>true</Success>
</GetRequestDiagnosisPageResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "Message" : "Successful",
  "RequestId" : "800FBAF5-A539-5B97-A09E-C63AB2F7****",
  "Data" : {
    "list" : [ {
      "messageId" : "61820b594664275c4429****",
      "uuid" : "hdm_51fe9bc19ec413f4d530431af87a****",
      "accountId" : "2093****",
      "sqlId" : "0c95dae3afef77be06572612df9b****",
      "engine" : "MySQL",
      "dbSchema" : "das",
      "param" : "{\"\":\"\"}",
      "state" : 2,
      "result" : "{     \"endTime\":1636354256000,     \"errorCode\":\"0001\",     \"errorMessage\":\"TFX succeeded\",     \"estimateCost\":{         \"cpu\":1.7878745150389268,         \"io\":9.948402604746128,         \"rows\":8.889372575194633     },     \"improvement\":12933.97,     \"indexAdvices\":[         {             \"columns\":[                 \"work_no\"             ],             \"ddlAddIndex\":\"ALTER TABLE `test`.`work_order` ADD INDEX `idx_workno` (`work_no`)\",             \"indexName\":\"idx_workno\",             \"schemaName\":\"test\",             \"tableName\":\"work_order\",             \"unique\":false         }     ],     \"ip\":\"****.mysql.rds.aliyuncs.com\",     \"messageId\":\"6188c8cb2f1365b16aee****\",     \"port\":3306,     \"sqlTag\":\"{\\\"PRED_EQUAL\\\":\\\"Y\\\",\\\"CNT_QB\\\":\\\"1\\\",\\\"CNT_TB\\\":\\\"1\\\"}\",     \"startTime\":1636354252000,     \"success\":true,     \"support\":true,     \"tuningAdvices\":[      ] }",
      "gmtCreate" : "1633071840000",
      "gmtModified" : "1633071850000"
    } ],
    "pageNo" : 1,
    "pageSize" : 10,
    "total" : 100,
    "extra" : "{\"\":\"\"}"
  },
  "Code" : "200",
  "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.