Queries the details about the slow query logs of a specified PolarDB cluster.

You can call this operation only if PolarDB for MySQL 5.6, PolarDB for MySQL 5.7, or PolarDB for MySQL 8.0 is used.

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 No DescribeSlowLogRecords

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

DBClusterId String Yes pc-************

The ID of the PolarDB cluster.

RegionId String Yes cn-hangzhou

The region ID of the PolarDB cluster.

Note You can call the DescribeRegions operation to query available regions.
StartTime String Yes 2019-11-18T16: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.

EndTime String Yes 2019-12-18T16:00Z

The end of the time range to query. The end time must be later than the start time. The maximum time range that can be specified is 31 days. Specify the time in the ISO 8601 standard in the yyyy-MM-ddTHH:mmZ format. The time must be in UTC.

DBName String No testdb

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. The value must be a positive integer.

Default value: 1.

SQLHASH String No U2FsdGVkxxxx

The unique ID of the SQL statement in the slow query log statistics. You can use the unique ID to query the logs of slow queries on the SQL statement.

Note You can call the DescribeSlowLogs operation to view the value of this parameter.

Response parameters

Parameter Type Example Description
Items Array

The details of slow query logs.

SQLSlowRecord
DBName String testdb

The name of the database.

DBNodeId String pi-***********

The ID of the node.

ExecutionStartTime String 2019-11-27T05:18:06Z

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 testdb[testdb] @ [100. **. **.242]

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

LockTimes Long 0

The period during which the SQL statement was locked. Unit: seconds.

ParseRowCounts Long 0

The number of parsed rows.

QueryTimes Long 10597

The amount of time that was taken to execute the SQL statement. Unit: seconds.

ReturnRowCounts Long 0

The number of returned rows.

SQLText String Binlog Dump

The SQL statements that are recorded in the log.

TotalRecordCount Integer 1

The total number of slow SQL queries.

PageNumber Integer 1

The page number of the page returned.

RequestId String BF2F38D4-5D03-442C-AFBD-8D266E******

The ID of the request.

DBClusterId String pc-************

The ID of the PolarDB cluster.

Engine String polardb_mysql

The database engine.

PageRecordCount Integer 1

The number of slow SQL queries on the current page.

Examples

Sample requests

http(s)://polardb.aliyuncs.com/? Action=DescribeSlowLogRecords
&DBClusterId=pc-************
&RegionId=cn-hangzhou
&StartTime=2019-11-18T16:00Z
&EndTime=2019-12-18T16:00Z
&<Common request parameters>

Sample success responses

XML format

<Items>
    <SQLSlowRecord>
        <ReturnRowCounts>0</ReturnRowCounts>
        <HostAddress>testdb[testdb] @  [100. **. **.242]</HostAddress>
        <SQLText>Binlog Dump</SQLText>
        <LockTimes>0</LockTimes>
        <ExecutionStartTime>2019-11-27T05:18:06Z</ExecutionStartTime>
        <ParseRowCounts>0</ParseRowCounts>
        <QueryTimes>10597</QueryTimes>
        <DBName>testdb</DBName>
        <DBNodeId>pi-***********</DBNodeId>
    </SQLSlowRecord>
</Items>
<TotalRecordCount>1</TotalRecordCount>
<PageNumber>1</PageNumber>
<RequestId>BF2F38D4-5D03-442C-AFBD-8D266E******</RequestId>
<DBClusterId>pc-************</DBClusterId>
<Engine>polardb_mysql</Engine>
<PageRecordCount>1</PageRecordCount>

JSON format

{
	"Items": {
		"SQLSlowRecord": [
            {
				"ReturnRowCounts": 0,
				"HostAddress": "testdb[testdb] @  [100. **. **.242]",
				"SQLText": "Binlog Dump",
				"LockTimes": 0,
				"ExecutionStartTime": "2019-11-27T05:18:06Z",
				"ParseRowCounts": 0,
				"QueryTimes": 10597,
				"DBName": "testdb",
				"DBNodeId": "pi-***********"
			}
		]
	},
	"TotalRecordCount": 1,
	"PageNumber": 1,
	"RequestId": "BF2F38D4-5D03-442C-AFBD-8D266E******",
	"DBClusterId": "pc-************",
	"Engine": "polardb_mysql",
	"PageRecordCount": 1
}

Error codes

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