Asynchronously collects the full request statistics in the SQL Explorer results of a database instance by SQL ID.

Note The complete query results are not returned immediately after an asynchronous call is made. If the value of isFinish is false in the response, wait for 1 second and then re-initiate the call. The complete query results are returned until the value of isFinish is true.

The SQL Explorer feature allows you to check the health status of SQL statements and troubleshoot performance issues. For more information, see SQL Explorer.

  • For information about database instances that support SQL Explorer, see Usage notes on DAS Professional Edition.
  • If you use an SDK to call Database Autonomy Service (DAS), you must set the region to cn-shanghai.

Request parameters

Parameter Type Required Example Description
Action String Yes GetFullRequestStatResultByInstanceId

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

UserId String No 196278346919****

The ID of the Alibaba Cloud account that was used to create the database instance.

Note This parameter is optional. The system can automatically obtain the account ID based on the value of the InstanceId parameter when this operation is called.
InstanceId String Yes rm-2ze8g2am97624****

The ID of the instance.

NodeId String No pi-bp12v7243x012****

The ID of the node.

Note This parameter is required for PolarDB for MySQL clusters.
SqlId String No d71f82be1eef72bd105128204d2e****

The ID of the SQL query.

Note If this parameter is specified, the full request statistics of the specified SQL query are collected. If this parameter is left empty, the full request statistics of the entire database instance are collected.
OriginHost String No 172.26.XX.XXX

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

Note This parameter is optional. If this parameter is specified, the full request statistics of the specified IP address are collected. If this parameter is left empty, the full request statistics of the entire database instance are collected.
Keyword String No dbtest01

The keywords used for query.

Start Long Yes 1645581813000

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

Note The start time can be up to 90 days earlier than the current time.
End Long Yes 1645668213000

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

Note The end time must be later than the start time. The interval cannot be more than 24 hours.
OrderBy String No count

The field by which to sort the results. Default value: count.

  • count: the number of executions.
  • avgRt: the average execution time.
  • rtRate: the execution duration percentage.
  • rowsExamined: the total number of scanned rows.
  • avgRowsExamined: the average number of scanned rows.
  • avgRowsReturned: the average number of returned rows.
Asc Boolean No Disabled

Specifies whether to sort the results in ascending order. By default, the results are not sorted in any order.

PageNo Integer Yes 1

The number of the page to return. Pages start from page 1. Default value: 1.

PageSize Integer Yes 20

The maximum number of entries to return on each page. Default value: 20.

SqlType String No SELECT

The type of the SQL statement.

DbName String No dbtest01

The name of the database.

Role String No polarx_cn

The role of the PolarDB-X 2.0 node.

  • polarx_cn: compute node
  • polarx_en: data node

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 7172BECE-588A-5961-8126-C216E16B****

The ID of the request.

Data Object

The returned data.

Result Object

The returned full request data.

List Array of List

The full request data entries.

SqlId String d71f82be1eef72bd105128204d2e****

The ID of the SQL query.

AvgFetchRows Long 0

The average number of rows that are fetched by compute nodes from data nodes on the PolarDB-X 2.0 instance.

AvgLockWaitTime Double 0.00009589874265269765

The average lock wait duration. Unit: seconds.

AvgLogicalRead Double 654.4470327860251

The average number of logical reads.

AvgPhysicalAsyncRead Long 0

The average number of physical asynchronous reads.

AvgPhysicalSyncRead Long 0

The average number of physical synchronous reads.

AvgExaminedRows Double 10000

The average number of scanned rows.

Note This parameter is returned only for ApsaraDB RDS for MySQL, ApsaraDB RDS for PostgreSQL, and PolarDB for MySQL databases.
AvgReturnedRows Double 10000

The average number of returned rows.

AvgUpdatedRows Long 10000

The average number of updated rows.

Note This parameter is returned only for ApsaraDB RDS for MySQL and PolarDB-X 2.0 databases.
AvgRt Double 2.499

The average execution duration.

AvgSqlCount Long 10000

The average number of SQL statements.

Count Long 100000

The total number of executions.

CountRate Double 0.0586

The percentage of the total number of executions.

Database String dbtest01

The name of the database.

ErrorCount Long 1

The number of failed executions.

FetchRows Long 0

The number of rows that are fetched by compute nodes from data nodes on the PolarDB-X 2.0 instance.

Ip String rm-uf6dyi58dm6****.mysql.rds.aliy****.com

The network address of the instance.

LockWaitTime Double 1089.4177720290281

The lock wait duration. Unit: seconds.

LogicalRead Long 7.434573266E9

The number of logical reads.

PhysicalAsyncRead Long 0

The number of physical asynchronous reads.

PhysicalSyncRead Long 0

The number of physical synchronous reads.

Port Long 3306

The port number.

Psql String select * from dbtest01 where ****

The SQL template.

Rows Long 0

The total number of rows updated or returned by the compute nodes of the PolarDB-X 2.0 instance.

ExaminedRows Long 10000

The total number of scanned rows.

Note This parameter is returned only for ApsaraDB RDS for MySQL, ApsaraDB RDS for PostgreSQL, and PolarDB for MySQL databases.
RtGreaterThanOneSecondCount Long 20

The number of SQL statements that take longer than 1 second to execute.

RtRate Double 2.499

The execution duration percentage.

SqlCount Long 200

The number of SQL statements.

SumUpdatedRows Long 100

The total number of updated rows.

Tables Array of String tabletest01,tabletest02

The names of tables in the database.

Version Long 1

The version.

VpcId String vpc-2zentqj1sk4qmolci****

The ID of the virtual private cloud (VPC).

Total Long 1

The total number of returned entries.

Fail Boolean false

Indicates whether the asynchronous request failed. Valid values:

  • true: The asynchronous request failed.
  • false: The asynchronous request is successful.
IsFinish Boolean true

Indicates whether the asynchronous request is complete.

  • true
  • false
ResultId String 9CB97BC4-6479-55D0-B9D0-EA925AFE****

The ID of the request.

State String SUCCESS

The state of the asynchronous request.

  • RUNNING
  • SUCCESS
  • FAIL
Timestamp Long 1645668213000

The time when the asynchronous request was made. The value of this parameter is a UNIX timestamp. Unit: milliseconds.

Code Long 200

The returned HTTP status code.

Success Boolean true

Indicates whether the request is successful. Valid values:

  • true
  • false

Examples

Sample requests

http(s)://das.cn-shanghai.aliyuncs.com/?Action=GetFullRequestStatResultByInstanceId
&UserId=196278346919****
&InstanceId=rm-2ze8g2am97624****
&SqlId=d71f82be1eef72bd105128204d2e****
&OriginHost=172.26.XX.XXX
&Keyword=dbtest01
&Start=1645581813000
&End=1645668213000
&OrderBy=count
&PageNo=1
&PageSize=20
&SqlType=SELECT
&DbName=dbtest01
&<Common request parameters>

Sample success responses

XML format

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

<GetFullRequestStatResultByInstanceIdResponse>
    <Message>Successful</Message>
    <RequestId>7172BECE-588A-5961-8126-C216E16B****</RequestId>
    <Data>
        <Result>
            <List>
                <SqlId>d71f82be1eef72bd105128204d2e****</SqlId>
                <AvgFetchRows>0</AvgFetchRows>
                <AvgLockWaitTime>0.00009589874265269765</AvgLockWaitTime>
                <AvgLogicalRead>654.4470327860251</AvgLogicalRead>
                <AvgPhysicalAsyncRead>0</AvgPhysicalAsyncRead>
                <AvgPhysicalSyncRead>0</AvgPhysicalSyncRead>
                <AvgExaminedRows>10000</AvgExaminedRows>
                <AvgReturnedRows>10000</AvgReturnedRows>
                <AvgUpdatedRows>10000</AvgUpdatedRows>
                <AvgRt>2.499</AvgRt>
                <AvgSqlCount>10000</AvgSqlCount>
                <Count>100000</Count>
                <CountRate>0.0586</CountRate>
                <Database>dbtest01</Database>
                <ErrorCount>1</ErrorCount>
                <FetchRows>0</FetchRows>
                <Ip>rm-uf6dyi58dm6****.mysql.rds.aliy****.com</Ip>
                <LockWaitTime>1089.4177720290281</LockWaitTime>
                <PhysicalAsyncRead>0</PhysicalAsyncRead>
                <PhysicalSyncRead>0</PhysicalSyncRead>
                <Port>3306</Port>
                <Psql>select * from dbtest01 where ****</Psql>
                <Rows>0</Rows>
                <ExaminedRows>10000</ExaminedRows>
                <RtGreaterThanOneSecondCount>20</RtGreaterThanOneSecondCount>
                <RtRate>2.499</RtRate>
                <SqlCount>200</SqlCount>
                <SumUpdatedRows>100</SumUpdatedRows>
                <Tables>tabletest01,tabletest02</Tables>
                <Version>1</Version>
                <VpcId>vpc-2zentqj1sk4qmolci****</VpcId>
            </List>
            <Total>1</Total>
        </Result>
        <Fail>false</Fail>
        <IsFinish>true</IsFinish>
        <ResultId>9CB97BC4-6479-55D0-B9D0-EA925AFE****</ResultId>
        <State>SUCCESS</State>
        <Timestamp>1645668213000</Timestamp>
    </Data>
    <Code>200</Code>
    <Success>true</Success>
</GetFullRequestStatResultByInstanceIdResponse>

JSON format

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

{
  "Message" : "Successful",
  "RequestId" : "7172BECE-588A-5961-8126-C216E16B****",
  "Data" : {
    "Result" : {
      "List" : {
        "SqlId" : "d71f82be1eef72bd105128204d2e****",
        "AvgFetchRows" : 0,
        "AvgLockWaitTime" : 9.589874265269765E-5,
        "AvgLogicalRead" : 654.4470327860251,
        "AvgPhysicalAsyncRead" : 0,
        "AvgPhysicalSyncRead" : 0,
        "AvgExaminedRows" : 10000,
        "AvgReturnedRows" : 10000,
        "AvgUpdatedRows" : 10000,
        "AvgRt" : 2.499,
        "AvgSqlCount" : 10000,
        "Count" : 100000,
        "CountRate" : 0.0586,
        "Database" : "dbtest01",
        "ErrorCount" : 1,
        "FetchRows" : 0,
        "Ip" : "rm-uf6dyi58dm6****.mysql.rds.aliy****.com",
        "LockWaitTime" : 1089.4177720290281,
        "PhysicalAsyncRead" : 0,
        "PhysicalSyncRead" : 0,
        "Port" : 3306,
        "Psql" : "select * from dbtest01 where ****",
        "Rows" : 0,
        "ExaminedRows" : 10000,
        "RtGreaterThanOneSecondCount" : 20,
        "RtRate" : 2.499,
        "SqlCount" : 200,
        "SumUpdatedRows" : 100,
        "Tables" : "tabletest01,tabletest02",
        "Version" : 1,
        "VpcId" : "vpc-2zentqj1sk4qmolci****"
      },
      "Total" : 1
    },
    "Fail" : false,
    "IsFinish" : true,
    "ResultId" : "9CB97BC4-6479-55D0-B9D0-EA925AFE****",
    "State" : "SUCCESS",
    "Timestamp" : 1645668213000
  },
  "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.