Queries the details of the slow query logs of a PolarDB cluster.
Debugging
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | Yes | DescribeSlowLogRecords |
The operation that you want to perform. Set the value to DescribeSlowLogRecords. |
RegionId | String | Yes | cn-hangzhou |
The region ID of the cluster. Note You can call the DescribeRegions operation to query the information of all regions that are available within your
account, such as the region IDs.
|
DBClusterId | String | Yes | pc-************ |
The ID of the cluster. Note You can call the DescribeDBClusters operation to query the information of all PolarDB clusters that are deployed within
a specified region, such as the cluster IDs.
|
StartTime | String | Yes | 2022-11-15T16:00Z |
The beginning of the time range to query. Specify the time in the Note
|
EndTime | String | Yes | 2022-11-16T04:00Z |
The end of the time range to query. The end time must be later than the start time.
The interval between the start time and end time must be within 24 hours. Specify
the time in the Note This parameter must be set to a time value in UTC (UTC+0 time zone). If your service
resides in another time zone, convert the time value. For example, if the local time
in the time zone where your service resides is 12:00 (UTC +8) and you want to query
slow query logs from 08:00 to 12:00 (UTC +8), set this parameter to a time value that
ranges from 00:00 to 04:00.
|
DBName | String | No | testdb |
The name of the database. |
PageSize | Integer | No | 30 |
The number of entries to return on each page. Valid values:
Default value: 30. |
PageNumber | Integer | No | 1 |
The number of the page to return. The value must be an integer that is larger than 0. Default value: 1. |
SQLHASH | String | No | U2FsdGVk**** |
The unique identifier of the SQL statement. The identifier is used to obtain the slow query logs of the SQL statement. |
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
TotalRecordCount | Integer | 1 |
The total number of SQL statements. |
PageRecordCount | Integer | 1 |
The number of entries returned per page. |
RequestId | String | A7E6A8FD-C50B-46B2-BA85-D8B8D3****** |
The ID of the request. |
PageNumber | Integer | 1 |
The number of the returned page. |
DBClusterId | String | pc-***************** |
The ID of the cluster. |
Items | Array of SQLSlowRecord |
Details about slow query logs. |
|
SQLSlowRecord | |||
ExecutionStartTime | String | 2021-04-07T03:47Z |
The time when the SQL statement was executed. The time is in the |
HostAddress | String | testdb[testdb] @ [100.**.**.242] |
The IP address of the client that is used to connect to the database. |
QueryTimes | Long | 20 |
The amount of time that was consumed to execute the SQL statement. Unit: seconds. |
SQLText | String | /* Query from *** by user 111 */ SELECT sleep(20) |
The query statement. |
ReturnRowCounts | Long | 0 |
The number of returned rows. |
ParseRowCounts | Long | 0 |
The number of parsed rows. |
DBName | String | testdb |
The name of the database. |
LockTimes | Long | 0 |
The period of time during which the SQL statement was locked. Unit: seconds. |
DBNodeId | String | pi-***************** |
The ID of the node. |
QueryTimeMS | Long | 100 |
The time range for the query. Unit: milliseconds. |
Engine | String | polardb_mysql |
The database engine that the cluster runs. |
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
HTTP/1.1 200 OK
Content-Type:application/xml
<DescribeSlowLogRecordsResponse>
<TotalRecordCount>1</TotalRecordCount>
<PageRecordCount>1</PageRecordCount>
<RequestId>A7E6A8FD-C50B-46B2-BA85-D8B8D3******</RequestId>
<PageNumber>1</PageNumber>
<DBClusterId>pc-*****************</DBClusterId>
<Items>
<ExecutionStartTime>2021-04-07T03:47Z</ExecutionStartTime>
<HostAddress>testdb[testdb] @ [100.**.**.242]</HostAddress>
<QueryTimes>20</QueryTimes>
<SQLText>/* Query from *** by user 111 */ SELECT sleep(20)</SQLText>
<ReturnRowCounts>0</ReturnRowCounts>
<ParseRowCounts>0</ParseRowCounts>
<DBName>testdb</DBName>
<LockTimes>0</LockTimes>
<DBNodeId>pi-*****************</DBNodeId>
<QueryTimeMS>100</QueryTimeMS>
</Items>
<Engine>polardb_mysql</Engine>
</DescribeSlowLogRecordsResponse>
JSON
format
HTTP/1.1 200 OK
Content-Type:application/json
{
"TotalRecordCount" : 1,
"PageRecordCount" : 1,
"RequestId" : "A7E6A8FD-C50B-46B2-BA85-D8B8D3******",
"PageNumber" : 1,
"DBClusterId" : "pc-*****************",
"Items" : [ {
"ExecutionStartTime" : "2021-04-07T03:47Z",
"HostAddress" : "testdb[testdb] @ [100.**.**.242]",
"QueryTimes" : 20,
"SQLText" : "/* Query from *** by user 111 */ SELECT sleep(20)",
"ReturnRowCounts" : 0,
"ParseRowCounts" : 0,
"DBName" : "testdb",
"LockTimes" : 0,
"DBNodeId" : "pi-*****************",
"QueryTimeMS" : 100
} ],
"Engine" : "polardb_mysql"
}
Error codes
For a list of error codes, see Service error codes.