Queries the slow query logs of an ApsaraDB for RDS instance.

  • The response parameters returned by this operation are updated every minute.
  • If the instance is running SQL Server, this operation is not supported.


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.

DBInstanceId String Yes rm-uf6wjk5xxxxxx

The ID of the instance.

EndTime String Yes 2011-06-20T16:00Z

The end of the time range to query. The end time must be later than the start time. The time span between the start time and the end time must be less than 31 days. Specify the time in the ISO 8601 standard in the yyyy-MM-ddTHH:mmZ format. The time must be in UTC.

StartTime String Yes 2011-06-01T16:00Z

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

SQLHASH String No U2FsdGVkxxxx

The unique ID of the specific SQL statement to query. If you specify this parameter, this operation will only return the slow query logs that involve the specified SQL statement.

DBName String No RDS_MySQL

The name of the specific database to query.

PageSize Integer No 30

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

PageNumber Integer No 1

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

Default value: 1.

Response parameters

Parameter Type Example Description
RequestId String 542BB8D6-4268-45CC-A557-B03EFD7AB30A

The ID of the request.

DBInstanceId String rm-uf6wjk5xxxxxxx

The ID of the instance.

Engine String MySQL

The database engine that the instance is running.

TotalRecordCount Integer 1

The total number of entries returned.

PageNumber Integer 1

The page number of the returned page.

PageRecordCount Integer 1

The number of SQL statements returned on the current page.

Items Array

An array that consists of slow query log entries.

HostAddress String

The IP address of the client connecting to the database.

DBName String testDB

The name of the database.

SQLText String select sleep(2)

SQL command.

QueryTimes Long 20

The time taken to execute the SQL statement. Unit: seconds.

LockTimes Long 12

The duration of the lock triggered by the SQL statement. Unit: seconds.

ParseRowCounts Long 100

The number of rows parsed.

ReturnRowCounts Long 1

The number of rows returned.

ExecutionStartTime String 2011-06-11T15:00:08Z

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

QueryTimeMS Long 20000

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


Sample requests

&<Common request parameters>

Sample success responses

XML format

        <HostAddress>test1[test1] @  [100.xxx.xxx.xxx]</HostAddress>
        <SQLText>select sleep(2)</SQLText>

JSON format

    "TotalRecordCount": 1,
    "PageRecordCount": 1,
    "RequestId": "4DBB1BB0-E5D8-4D41-B1C9-142364DB4986",
    "DBInstanceId": "rm-uf6wjk5xxxxxxx",
    "PageNumber": 1,
    "Items": {
        "SQLSlowRecord": [
                "QueryTimes": 2,
                "ExecutionStartTime": "2020-07-20T02:03:10Z",
                "ReturnRowCounts": 1,
                "LockTimes": 0,
                "DBName": "testDB",
                "ParseRowCounts": 1,
                "HostAddress": "test1[test1] @  [100.xxx.xxx.xxx]",
                "QueryTimeMS": 2000,
                "SQLText": "select sleep(2)"
    "Engine": "MySQL"

Error codes

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