You can call this operation to query 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 rm-uf6wjk5xxxxxxxxxx

The ID of the cluster.

EndTime String Yes 2019-06-20T16:05:00Z

The end of the time range to query. The end time must be later than the start time. The specified time range must be less than seven days.

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

StartTime String Yes 2019-06-01T16:05:00Z

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

DBName String No test_db

The name of the database.

PageSize Integer No 30

The number of entries to return on each page. Valid values:

  • 30
  • 50
  • 100

Default value: 30.

PageNumber Integer No 1

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

Default value: 1.

ProcessID String No 201907241445301720211111570315107****

The ID of the process.

Order String No "Field":"ScanRows", "Type":"Asc"

Sorts data by the specified fields in the JSON format, which is an ordered array that uses the order of the input array and contains the Field and Type fields.

Field indicates the field names to be sorted. The following fields are supported:

  • HostAddress
  • UserName
  • ExecutionStartTime
  • QueryTime
  • PeakMemoryUsage
  • ScanRows
  • ScanSize
  • ScanTime
  • PlanningTime
  • WallTime
  • ProcessID

Type indicates the sort types. Valid values:

  • Desc
  • Asc
Range String No "Field":"QueryTime", "Min":"1000", "Max":"10000"

Filters the range by using specified indicators such as Min and Max. The parameter is in the JSON format and is a JSON array.

Field indicates the field names whose range is restricted. The following fields are supported:

  • ScanSize(KB)
  • QueryTime(ms)
  • PeakMemoryUsage(KB)

Min indicates the minimum value of the query range (left operand). Max indicates the maximum value of the query range (right operand). Data type: String.

Response parameters

Parameter Type Example Description
DBClusterId String rm-uf6wjk5xxxxxxxxxx

The ID of the cluster.

Items Array of SlowLogRecord

The details of slow query logs.

SlowLogRecord
DBName String test_database

The name of the database.

ExecutionStartTime String 2019-06-01T16:00Z

The time when the SQL statement started to be executed. The time follows the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time is displayed in UTC.

HostAddress String 192.101.2.11

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

OutputSize String 945

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

ParseRowCounts Long 24

The number of parsed rows.

PeakMemoryUsage String 3.059

The peak memory of the query. Unit: KB.

PlanningTime Long 12

The time consumed to generate the execution plan. Unit: milliseconds.

ProcessID String 201907241445301720211111570315107****

The ID of the process.

QueryTime Long 12

The execution duration of the query. Unit: ms.

QueueTime Long 34

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

ReturnRowCounts Long 123

The number of returned rows.

SQLText String select count(*) from test where name = '8'

The query statement.

ScanRows Long 0

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

ScanSize String 0.703

The amount of data scanned in storage. Unit: KB.

ScanTime Long 14

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

State String SUCCESSED

The status of the query.

UserName String testuser

The username.

WallTime Long 13

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

PageNumber String 1

The number of the page to return.

PageSize String 2

The total number of pages returned.

RequestId String 1AD222E9-E606-4A42-BF6D-8A4442913CEF

The ID of the request.

TotalCount String 100

The total number of returned entries.

Examples

Sample requests

http(s)://adb.aliyuncs.com/? Action=DescribeSlowLogRecords
&DBClusterId=am-uf6wjk5xxxxxxx
&StartTime=2011-06-01T16:00:00Z
&EndTime=2011-06-20T16:00:00Z
&<Common request parameters>

Sample success responses

XML format

<DescribeSlowLogRecordsResponse>
    <RequestId>542BB8D6-4268-45CC-A557-B03EFD7AB30A</RequestId>
    <DBClusterID>am-uf6wjk5xxxxxxx</DBClusterID>
    <TotalCount>46</TotalCount>
    <PageNumber>1</PageNumber>
    <PageSize>30</PageSize>
    <Items>
        <SQLSlowRecord>
            <UserName>kepler</UserName>
            <PeakMemoryUsage>3.059</PeakMemoryUsage>
            <ExecutionStartTime>2020-02-27T14:05:42Z</ExecutionStartTime>
            <State>SUCCESSED</State>
            <ReturnRowCounts>48</ReturnRowCounts>
            <DBName>test_db</DBName>
            <QueryTime>78</QueryTime>
            <ParseRowCounts>48</ParseRowCounts>
            <ProcessID>2020022722054217201625219703151343962</ProcessID>
            <ScanSize>0.703</ScanSize>
            <HostAddress>172.16.252.197:3004</HostAddress>
            <SQLText>SELECT * FROM test</SQLText>
        </SQLSlowRecord>
    </Items>
</DescribeSlowLogRecordsResponse>

JSON format

{
    "TotalCount": 100,
    "RequestId": "1AD222E9-E606-4A42-BF6D-8A4442913CEF",
    "PageSize": 2,
    "PageNumber": 1,
    "DBClusterId": "rm-uf6wjk5xxxxxxxxxx",
    "Items": {
        "SlowLogRecord": {
            "UserName": "testuser",
            "PeakMemoryUsage": 3.059,
            "ExecutionStartTime": "2019-06-01T16:00Z",
            "QueryTime": 12,
            "ParseRowCounts": 24,
            "HostAddress": "192.101.2.11",
            "SQLText": "select count(*) from test where name = '8'",
            "State": "SUCCESSED",
            "ReturnRowCounts": 123,
            "DBName": "test_database",
            "QueueTime": 34,
            "ProcessID": 2.0190724144529173e+36,
            "ScanSize": 0.703
        }
    }
}

Error codes

HttpCode 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 you specify the cluster ID value correctly.

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