All Products
Search
Document Center

AnalyticDB for MySQL:DescribeSQLPlan

Last Updated:Apr 23, 2024

Queries the plan information about an SQL statement such as 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.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
adb:DescribeSQLPlanRead
  • DBCluster
    acs:adb:{#regionId}:{#accountId}:dbcluster/{#DBClusterId}
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
DBClusterIdstringYes

The cluster ID.

Note You can call the DescribeDBClusters operation to query the information about all AnalyticDB for MySQL clusters within a region, including cluster IDs.
am-****************
ProcessIdstringYes

The query ID.

Note You can call the DescribeProcessList operation to query the IDs of queries that are being executed.
202105271604431720161662490345*******

Response parameters

ParameterTypeDescriptionExample
object

The response parameters.

RequestIdstring

The request ID.

22D6DEF0-CBC7-4388-A41C-D5FD62******
StageListobject []

The queried plan in different stages.

Statestring

The final execution state of the stage. Valid values:

  • FINISHED
  • CANCELED
  • ABORTED
  • FAILED
FINISHED
CPUTimeAvglong

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

5984
CPUTimeMaxlong

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

5984
OperatorCostlong

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.

5984
ScanTimeMaxlong

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

0
InputSizeMaxlong

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

173
StageIdinteger

The stage ID.

1
ScanSizeMaxlong

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

0
CPUTimeMinlong

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

47
ScanTimeMinlong

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

0
ScanSizeMinlong

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

0
InputSizeMinlong

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

173
PeakMemorylong

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

74208
ScanTimeAvglong

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

0
ScanSizeAvglong

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

0
InputSizeAvglong

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

173
OriginInfostring

The original information about the SQL statement.

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

The execution information about the SQL statement.

SQLstring

The SQL statement.

INSERT OVERWRITE INTO hdfs_import_external\nSELECT *\nFROM adb_hdfs_import_source
OutputSizelong

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

9
Statestring

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

  • FINISHED
  • FAILED
FINISHED
OutputRowslong

The total number of rows generated by the SQL statement.

1
Userstring

The name of the user who submitted the SQL statement.

test_acc
StartTimestring

The execution start time of the SQL statement. This value is a UNIX timestamp representing the number of milliseconds that have elapsed since January 1, 1970, 00:00:00 UTC.

1622102683243
TotalStagelong

The total number of stages in the SQL statement.

4
QueuedTimelong

The amount of time consumed to queue the SQL statement. Unit: milliseconds.

0
TotalTimelong

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

2340
TotalTasklong

The total number of tasks in the SQL statement.

4
Databasestring

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

adb_demo
PeakMemorylong

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

441802
ClientIPstring

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

172.16.***.***
PlanningTimelong

The amount of time consumed to generate the execution plan of the SQL statement. Unit: milliseconds.

86
CPUTimelong

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

6100

Examples

Sample success responses

JSONformat

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

Error codes

HTTP status codeError codeError messageDescription
404InvalidDBCluster.NotFoundThe DBClusterId provided does not exist in our records.The specified DBClusterId parameter does not exist. Make sure that the DBClusterId value is valid.

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
No change history