Queries the information of an SQL statement, such as the information of a query statement or an Extract, Transform, Load (ETL) task statement.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes DescribeSQLPlan

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

DBClusterId String Yes am-****************

The ID of the cluster.

Note You can call the DescribeDBClusters operation to query details about all AnalyticDB for MySQL clusters in a specific region, including cluster IDs.
ProcessId String Yes 202105271604431720161662490345*******

The ID of the task.

Note You can call the DescribeSlowLogRecords operation to query the task ID of the SQL statement.

Response parameters

Parameter Type Example Description
RequestId String 22D6DEF0-CBC7-4388-A41C-D5FD62******

The ID of the request.

StageList Array of SqlPlanStage

Details about the plan stages.

State String FINISHED

The final execution state of the stage. Valid values:

  • FINISHED
  • CANCELED
  • ABORTED
  • FAILED
CPUTimeAvg Long 5984

The average CPU Time value on each compute node in the stage. Unit: milliseconds.

CPUTimeMax Long 5984

The maximum CPU Time value on each compute node in the stage. Unit: milliseconds.

OperatorCost Long 5984

The total CPU time consumed by all operators in the stage, which is equivalent to the total CPU time of the stage. You can use this parameter to determine which parts of the stage consume a large amount of computing resources. Unit: milliseconds.

ScanTimeMax Long 0

The maximum amount of time consumed by a scan operator to read data on each storage node in the stage. Unit: milliseconds.

InputSizeMax Long 173

The maximum amount of input data on each compute node in the stage. Unit: byte.

StageId Integer 1

The ID of the stage.

ScanSizeMax Long 0

The maximum amount of data scanned by a scan operator on each storage node in the stage. Unit: byte.

CPUTimeMin Long 47

The minimum CPU Time value on each compute node in the stage. Unit: milliseconds.

ScanTimeMin Long 0

The minimum amount of time consumed by a scan operator to read data on each storage node in the stage. Unit: milliseconds.

ScanSizeMin Long 0

The minimum amount of data scanned by a scan operator on each storage node in the stage. Unit: byte.

InputSizeMin Long 173

The minimum amount of input data on each compute node in the stage. Unit: byte.

PeakMemory Long 74208

The maximum memory usage when the SQL statement is executed. Unit: byte.

ScanTimeAvg Long 0

The average amount of time consumed by a scan operator to read data on each storage node in the stage. Unit: milliseconds.

ScanSizeAvg Long 0

The average amount of data scanned by a scan operator on each storage node in the stage. Unit: byte.

InputSizeAvg Long 173

The average amount of input data on each compute node in the stage. Unit: byte.

OriginInfo String {\"queryId\":\"20210527_160443_10581_hdhzr\",\"session\":{\"queryId\":\"20210527_160443_10581_hdhzr\",\"hasSharedStage\":false,\"parentId\":0}}

The original details of the SQL statement.

Detail Object

Details about the execution of the SQL statement.

SQL String INSERT OVERWRITE INTO hdfs_import_external\nSELECT *\nFROM adb_hdfs_import_source

The SQL statement.

OutputSize Long 9

The total amount of data generated by the SQL statement. Unit: byte.

State String FINISHED

The final execution state of the SQL statement. Valid values:

  • FINISHED
  • FAILED
OutputRows Long 1

The total number of rows generated by the SQL statement.

User String test_acc

The name of the user who submitted the SQL statement.

StartTime String 1622102683243

The beginning of the time range in which the SQL statement is executed. The time is in the UNIX timestamp format. Unit: milliseconds.

TotalStage Long 4

The total number of stages in the SQL statement.

QueuedTime Long 0

The amount of time that the SQL statement is queued before it is executed. Unit: milliseconds.

TotalTime Long 2340

The time consumed to execute the SQL statement. Unit: milliseconds.

TotalTask Long 4

The total number of tasks in the SQL statement.

Database String adb_demo

The name of the database on which the SQL statement is executed.

PeakMemory Long 441802

The maximum memory usage when the SQL statement is executed. Unit: byte.

ClientIP String 172.16.***.***

The IP address of the client that is used to execute the SQL statement.

PlanningTime Long 86

The time when the execution plan of the SQL statement is generated. Unit: milliseconds.

CPUTime Long 6100

The total CPU time consumed by all operators on multithreaded servers when the SQL statement is executed. Unit: milliseconds.

Examples

Sample requests

http(s)://adb.aliyuncs.com/?Action=DescribeSQLPlan
&DBClusterId=am-****************
&ProcessId=202105271604431720161662490345*******
&<Common request parameters>

Sample success responses

XML format

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

<DescribeSQLPlanResponse>
    <RequestId>22D6DEF0-CBC7-4388-A41C-D5FD62******</RequestId>
    <StageList>
        <ScanSizeMin>0</ScanSizeMin>
        <ScanSizeAvg>0</ScanSizeAvg>
        <StageId>0</StageId>
        <PeakMemory>264960</PeakMemory>
        <CPUTimeMax>47</CPUTimeMax>
        <ScanTimeMin>0</ScanTimeMin>
        <ScanTimeAvg>0</ScanTimeAvg>
        <InputSizeMax>1023</InputSizeMax>
        <InputSizeMin>1023</InputSizeMin>
        <InputSizeAvg>1023</InputSizeAvg>
        <ScanSizeMax>0</ScanSizeMax>
        <State>FINISHED</State>
        <OperatorCost>47</OperatorCost>
        <ScanTimeMax>0</ScanTimeMax>
        <CPUTimeMin>47</CPUTimeMin>
        <CPUTimeAvg>47</CPUTimeAvg>
    </StageList>
    <StageList>
        <ScanSizeMin>0</ScanSizeMin>
        <ScanSizeAvg>0</ScanSizeAvg>
        <StageId>1</StageId>
        <PeakMemory>74208</PeakMemory>
        <CPUTimeMax>5984</CPUTimeMax>
        <ScanTimeMin>0</ScanTimeMin>
        <ScanTimeAvg>0</ScanTimeAvg>
        <InputSizeMax>173</InputSizeMax>
        <InputSizeMin>173</InputSizeMin>
        <InputSizeAvg>173</InputSizeAvg>
        <ScanSizeMax>0</ScanSizeMax>
        <State>FINISHED</State>
        <OperatorCost>5984</OperatorCost>
        <ScanTimeMax>0</ScanTimeMax>
        <CPUTimeMin>5984</CPUTimeMin>
        <CPUTimeAvg>5984</CPUTimeAvg>
    </StageList>
    <StageList>
        <ScanSizeMin>0</ScanSizeMin>
        <ScanSizeAvg>0</ScanSizeAvg>
        <StageId>2</StageId>
        <PeakMemory>102634</PeakMemory>
        <CPUTimeMax>18</CPUTimeMax>
        <ScanTimeMin>0</ScanTimeMin>
        <ScanTimeAvg>0</ScanTimeAvg>
        <InputSizeMax>173</InputSizeMax>
        <InputSizeMin>173</InputSizeMin>
        <InputSizeAvg>173</InputSizeAvg>
        <ScanSizeMax>0</ScanSizeMax>
        <State>FINISHED</State>
        <OperatorCost>18</OperatorCost>
        <ScanTimeMax>0</ScanTimeMax>
        <CPUTimeMin>18</CPUTimeMin>
        <CPUTimeAvg>18</CPUTimeAvg>
    </StageList>
    <StageList>
        <ScanSizeMin>36</ScanSizeMin>
        <ScanSizeAvg>36</ScanSizeAvg>
        <StageId>3</StageId>
        <PeakMemory>0</PeakMemory>
        <CPUTimeMax>51</CPUTimeMax>
        <ScanTimeMin>10</ScanTimeMin>
        <ScanTimeAvg>10</ScanTimeAvg>
        <InputSizeMax>36</InputSizeMax>
        <InputSizeMin>36</InputSizeMin>
        <InputSizeAvg>36</InputSizeAvg>
        <ScanSizeMax>36</ScanSizeMax>
        <State>FINISHED</State>
        <OperatorCost>51</OperatorCost>
        <ScanTimeMax>10</ScanTimeMax>
        <CPUTimeMin>51</CPUTimeMin>
        <CPUTimeAvg>51</CPUTimeAvg>
    </StageList>
    <OriginInfo>{"queryId":"20210527_160443_10581_hdhzr","session":{"queryId":"20210527_160443_10581_hdhzr","hasSharedStage":false,"parentId":0}}</OriginInfo>
    <Detail>
        <TotalTask>4</TotalTask>
        <OutputSize>9</OutputSize>
        <User>test_acc</User>
        <TotalStage>4</TotalStage>
        <PeakMemory>441802</PeakMemory>
        <StartTime>1622102683243</StartTime>
        <ClientIP>172.16.***.***</ClientIP>
        <SQL>INSERT OVERWRITE INTO hdfs_import_external
SELECT *
FROM adb_hdfs_import_source</SQL>
        <CPUTime>6100</CPUTime>
        <QueuedTime>0</QueuedTime>
        <State>FINISHED</State>
        <Database>adb_demo</Database>
        <TotalTime>2340</TotalTime>
        <PlanningTime>86</PlanningTime>
        <OutputRows>1</OutputRows>
    </Detail>
</DescribeSQLPlanResponse>

JSON format

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

{
  "RequestId" : "22D6DEF0-CBC7-4388-A41C-D5FD62******",
  "StageList" : [ {
    "ScanSizeMin" : 0,
    "ScanSizeAvg" : 0,
    "StageId" : 0,
    "PeakMemory" : 264960,
    "CPUTimeMax" : 47,
    "ScanTimeMin" : 0,
    "ScanTimeAvg" : 0,
    "InputSizeMax" : 1023,
    "InputSizeMin" : 1023,
    "InputSizeAvg" : 1023,
    "ScanSizeMax" : 0,
    "State" : "FINISHED",
    "OperatorCost" : 47,
    "ScanTimeMax" : 0,
    "CPUTimeMin" : 47,
    "CPUTimeAvg" : 47
  }, {
    "ScanSizeMin" : 0,
    "ScanSizeAvg" : 0,
    "StageId" : 1,
    "PeakMemory" : 74208,
    "CPUTimeMax" : 5984,
    "ScanTimeMin" : 0,
    "ScanTimeAvg" : 0,
    "InputSizeMax" : 173,
    "InputSizeMin" : 173,
    "InputSizeAvg" : 173,
    "ScanSizeMax" : 0,
    "State" : "FINISHED",
    "OperatorCost" : 5984,
    "ScanTimeMax" : 0,
    "CPUTimeMin" : 5984,
    "CPUTimeAvg" : 5984
  }, {
    "ScanSizeMin" : 0,
    "ScanSizeAvg" : 0,
    "StageId" : 2,
    "PeakMemory" : 102634,
    "CPUTimeMax" : 18,
    "ScanTimeMin" : 0,
    "ScanTimeAvg" : 0,
    "InputSizeMax" : 173,
    "InputSizeMin" : 173,
    "InputSizeAvg" : 173,
    "ScanSizeMax" : 0,
    "State" : "FINISHED",
    "OperatorCost" : 18,
    "ScanTimeMax" : 0,
    "CPUTimeMin" : 18,
    "CPUTimeAvg" : 18
  }, {
    "ScanSizeMin" : 36,
    "ScanSizeAvg" : 36,
    "StageId" : 3,
    "PeakMemory" : 0,
    "CPUTimeMax" : 51,
    "ScanTimeMin" : 10,
    "ScanTimeAvg" : 10,
    "InputSizeMax" : 36,
    "InputSizeMin" : 36,
    "InputSizeAvg" : 36,
    "ScanSizeMax" : 36,
    "State" : "FINISHED",
    "OperatorCost" : 51,
    "ScanTimeMax" : 10,
    "CPUTimeMin" : 51,
    "CPUTimeAvg" : 51
  } ],
  "OriginInfo" : "{\"queryId\":\"20210527_160443_10581_hdhzr\",\"session\":{\"queryId\":\"20210527_160443_10581_hdhzr\",\"hasSharedStage\":false,\"parentId\":0}}",
  "Detail" : {
    "TotalTask" : 4,
    "OutputSize" : 9,
    "User" : "test_acc",
    "TotalStage" : 4,
    "PeakMemory" : 441802,
    "StartTime" : 1622102683243,
    "ClientIP" : "172.16.***.***",
    "SQL" : "INSERT OVERWRITE INTO hdfs_import_external\nSELECT *\nFROM adb_hdfs_import_source",
    "CPUTime" : 6100,
    "QueuedTime" : 0,
    "State" : "FINISHED",
    "Database" : "adb_demo",
    "TotalTime" : 2340,
    "PlanningTime" : 86,
    "OutputRows" : 1
  }
}

Error codes

HTTP status code Error code Error message Description
404 InvalidDBCluster.NotFound The DBClusterId provided does not exist in our records. The error message returned because the specified cluster ID does not exist. Check whether the cluster ID is valid.

For a list of error codes, visit the API Error Center.