Queries the details about the slow query logs of an AnalyticDB for MySQL cluster.

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 DescribeSlowLogRecords

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

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

The ID of the cluster.

Note You can call the DescribeDBClusters operation to query the details about all AnalyticDB for MySQL clusters in a specific region, including cluster IDs.
StartTime String Yes 2021-05-20T16:00:00Z

The beginning of the time range to query. Specify the time in the yyyy-MM-ddTHH:mm:ssZ format. The time must be in UTC.

EndTime String Yes 2021-05-27T16:00:00Z

The end of the time range to query. Specify the time in the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time must be in UTC.

Note The end time must be later than the start time. The specified time range must be less than seven days.
DBName String No adb_demo

The name of the database.

PageSize Integer No 30

The number of entries to return on each page. Valid values: 30, 50, and 100. Default value: 30.

PageNumber Integer No 1

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

ProcessID String No 2021052716044317201616624903453******

The ID of the process.

Order String No [{"Field":"ExecutionStartTime","Type":"Desc"},{"Field":"ScanRows","Type":"Asc"}]

The order in which to sort the retrieved entries by field. Specify this value in the JSON format. The value is an ordered array that uses the order of the input array and contains Field and Type. Example: [{"Field":"ExecutionStartTime","Type":"Desc"},{"Field":"ScanRows","Type":"Asc"}].

  • Field: the field that is used to sort the retrieved entries. Valid values:
    • HostAddress: the IP address of the client that is used to connect to the database.
    • UserName: the username.
    • ExecutionStartTime: the start time of the query execution.
    • QueryTime: the time consumed to execute the SQL statement.
    • PeakMemoryUsage: the maximum memory usage when the SQL statement is executed.
    • ScanRows: the number of rows to be scanned from a data source in the task.
    • ScanSize: the amount of data to be scanned.
    • ScanTime: the total time consumed to scan data.
    • PlanningTime: the time consumed to generate execution plans.
    • WallTime: the accumulated CPU Time values of all operators in the query on each node.
    • ProcessID: the ID of the process.
  • Type: the sorting sequence of the retrieved entries. Valid values:
    • Desc: The entries are sorted in descending order.
    • Asc: The entries are sorted in ascending order.
Range String No [{"Field":"ScanSize","Min":"1000000","Max":"10000000"},{"Field":"QueryTime","Min":"1000","Max":"10000"}]

Filters the data based on the Max and Min values of the specified field. Specify the values of the field in the JSON format. Example: [{"Field":"ScanSize","Min":"1000000","Max":"10000000"},{"Field":"QueryTime","Min":"1000","Max":"10000"}].

Field: the field whose value range is to be restricted. Valid values:

  • ScanSize: the amount of data to be scanned. Unit: KB.
  • QueryTime: the time consumed to execute the statement. Unit: milliseconds.
  • PeakMemoryUsage: the maximum memory usage when the SQL statement is executed. Unit: KB.
Note Min indicates the minimum value of the query range (left operand). Max indicates the maximum value of the query range (right operand). Max and Min are both of the String type.
State String No SUCCESSED

The state of the query.

Response parameters

Parameter Type Example Description
TotalCount String 100

The total number of entries returned.

PageSize String 30

The number of entries returned on the current page.

RequestId String D7559209-7EC3-41E1-8F78-156990******

The ID of the request.

PageNumber String 1

The page number of the returned page.

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

The ID of the cluster.

Items Array of SlowLogRecord

Details about the slow query logs.

SlowLogRecord
HostAddress String 172.16.***.***

The IP address of the client that is used to connect to the database.

ScanTime Long 10

The total time consumed to scan data. It is the accumulated value among multiple TableScanNode nodes. Unit: milliseconds.

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

Details about the SQL statement.

OutputSize String 0.009

The amount of output data in the task. Unit: byte.

PeakMemoryUsage String 431.447

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

State String SUCCESSED

The execution state of the SQL statement.

WallTime Long 6100

The accumulated CPU Time values of all operators in the query on each node. Unit: milliseconds.

ScanSize String 0.035

The amount of scanned data. Unit: KB.

ExecutionStartTime String 2021-05-27T08:04:43Z

The beginning of the time range in which the SQL statement is executed. The time follows the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time is displayed in UTC.

QueryTime Long 2344

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

ReturnRowCounts Long 1

The number of returned rows.

ScanRows Long 3

The number of rows scanned from a data source in the task.

ParseRowCounts Long 0

The number of parsed rows.

DBName String adb_demo

The name of the database.

PlanningTime Long 12

The time consumed to generate execution plans. Unit: milliseconds.

QueueTime Long 0

The queuing duration before the query is executed. Unit: milliseconds.

UserName String test

The username.

ProcessID String 2021052716044317201616624903453******

The ID of the process.

Examples

Sample requests

http(s)://adb.aliyuncs.com/?Action=DescribeSlowLogRecords
&DBClusterId=am-****************
&StartTime=2021-05-20T16:00:00Z
&EndTime=2021-05-27T16:00:00Z
&<Common request parameters>

Sample success responses

XML format

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

<DescribeSlowLogRecordsResponse>
    <TotalCount>1</TotalCount>
    <RequestId>D7559209-7EC3-41E1-8F78-156990******</RequestId>
    <PageSize>30</PageSize>
    <PageNumber>1</PageNumber>
    <DBClusterId>am-****************</DBClusterId>
    <Items>
        <SlowLogRecord>
            <OutputSize>0.009</OutputSize>
            <UserName>test</UserName>
            <PeakMemoryUsage>431.447</PeakMemoryUsage>
            <ExecutionStartTime>2021-05-27T08:04:43Z</ExecutionStartTime>
            <ParseRowCounts>0</ParseRowCounts>
            <QueryTime>2344</QueryTime>
            <ScanTime>10</ScanTime>
            <HostAddress>172.16.***.***</HostAddress>
            <SQLText>INSERT OVERWRITE INTO hdfs_import_external
SELECT *
FROM adb_hdfs_import_source</SQLText>
            <WallTime>6100</WallTime>
            <ScanRows>3</ScanRows>
            <State>SUCCESSED</State>
            <ReturnRowCounts>1</ReturnRowCounts>
            <PlanningTime>86</PlanningTime>
            <DBName>adb_demo</DBName>
            <QueueTime>0</QueueTime>
            <ProcessID>2021052716044317201616624903453******</ProcessID>
            <ScanSize>0.035</ScanSize>
        </SlowLogRecord>
    </Items>
</DescribeSlowLogRecordsResponse>

JSON format

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

{
  "TotalCount" : 1,
  "RequestId" : "D7559209-7EC3-41E1-8F78-156990******",
  "PageSize" : 30,
  "PageNumber" : 1,
  "DBClusterId" : "am-****************",
  "Items" : {
    "SlowLogRecord" : [ {
      "OutputSize" : "0.009",
      "UserName" : "test",
      "PeakMemoryUsage" : "431.447",
      "ExecutionStartTime" : "2021-05-27T08:04:43Z",
      "ParseRowCounts" : 0,
      "QueryTime" : 2344,
      "ScanTime" : 10,
      "HostAddress" : "172.16.***.***",
      "SQLText" : "INSERT OVERWRITE INTO hdfs_import_external\nSELECT *\nFROM adb_hdfs_import_source",
      "WallTime" : 6100,
      "ScanRows" : 3,
      "State" : "SUCCESSED",
      "ReturnRowCounts" : 1,
      "PlanningTime" : 86,
      "DBName" : "adb_demo",
      "QueueTime" : 0,
      "ProcessID" : "2021052716044317201616624903453******",
      "ScanSize" : "0.035"
    } ]
  }
}

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.