Queries the slow query log statistics information of a PolarDB cluster.
Operation description
Only PolarDB for MySQL supports this operation.
Starting from September 1, 2024, due to the optimization of the SQL template algorithm, the value of the SQLHash field will change when you call this operation. For more information, see Notice: Optimization of the slow SQL template algorithm.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
polardb:DescribeSlowLogs |
get |
*dbcluster
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| RegionId |
string |
Yes |
The region ID. |
cn-hangzhou |
| DBClusterId |
string |
Yes |
The cluster ID. |
pc-**************** |
| StartTime |
string |
Yes |
The start date of the query. The interval between the start date and the current date cannot exceed 31 days. Format: yyyy-MM-ddZ (UTC). |
2021-05-01Z |
| EndTime |
string |
Yes |
The end date of the query. The end date must be later than or equal to the start date. The interval between the start date and the end date cannot exceed 31 days. Format: yyyy-MM-ddZ (UTC). |
2021-05-30Z |
| DBName |
string |
No |
The name of the database. |
PolarDB_MySQL |
| PageSize |
integer |
No |
The number of entries per page. Valid values: 30 to 100. Default value: 30. |
30 |
| PageNumber |
integer |
No |
The page number. The value must be a positive integer that does not exceed the maximum value of the Integer data type. Default value: 1. |
1 |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
|||
| TotalRecordCount |
integer |
The total number of records. |
5 |
| PageRecordCount |
integer |
The number of SQL statements on the current page. |
6 |
| EndTime |
string |
The end date of the query. The date is in UTC. Format: YYYY-MM-DDZ. |
2021-05-30Z |
| RequestId |
string |
The request ID. |
2553A660-E4EB-4AF4-A402-8AFF70A49143 |
| PageNumber |
integer |
The page number. |
3 |
| StartTime |
string |
The start date of the query. The date is in UTC. Format: YYYY-MM-DDZ. |
2021-05-01Z |
| DBClusterId |
string |
The cluster ID. |
pc-**************** |
| Items |
object |
||
| SQLSlowLog |
array<object> |
The list of slow query log entries. |
|
|
object |
|||
| SQLText |
string |
The SQL statement. |
select id,name from tb_table |
| ReturnMaxRowCount |
integer |
The maximum number of rows returned by the SQL statement. |
3 |
| CreateTime |
string |
The date when the data was generated. |
2021-05-30Z |
| MaxExecutionTime |
integer |
The maximum execution duration. Unit: seconds. |
60 |
| ParseTotalRowCounts |
integer |
The total number of rows parsed by the SQL statement. |
2 |
| TotalLockTimes |
integer |
The total lock duration. Unit: seconds. |
1 |
| TotalExecutionTimes |
integer |
The total execution duration. Unit: seconds. |
2 |
| DBNodeId |
string |
The node ID. |
pi-*************** |
| SQLHASH |
string |
The unique identifier of the SQL statement in the slow query log statistics. You can use this identifier to obtain the slow query log details of the SQL statement. |
U2FsdGVkxxxx |
| ParseMaxRowCount |
integer |
The maximum number of rows parsed by the SQL statement. |
1 |
| MaxLockTime |
integer |
The maximum lock duration. Unit: seconds. |
1 |
| ReturnTotalRowCounts |
integer |
The total number of rows returned by the SQL statement. |
1 |
| DBName |
string |
The name of the database. |
PolarDB_MySQL |
| TotalExecutionCounts |
integer |
The total number of executions. |
2 |
| MaxExecutionTimeMs |
string |
The maximum execution duration. Unit: milliseconds. |
60000 |
| Engine |
string |
The database engine. |
polardb_mysql |
Examples
Success response
JSON format
{
"TotalRecordCount": 5,
"PageRecordCount": 6,
"EndTime": "2021-05-30Z",
"RequestId": "2553A660-E4EB-4AF4-A402-8AFF70A49143",
"PageNumber": 3,
"StartTime": "2021-05-01Z",
"DBClusterId": "pc-****************",
"Items": {
"SQLSlowLog": [
{
"SQLText": "select id,name from tb_table",
"ReturnMaxRowCount": 3,
"CreateTime": "2021-05-30Z",
"MaxExecutionTime": 60,
"ParseTotalRowCounts": 2,
"TotalLockTimes": 1,
"TotalExecutionTimes": 2,
"DBNodeId": "pi-***************",
"SQLHASH": "U2FsdGVkxxxx",
"ParseMaxRowCount": 1,
"MaxLockTime": 1,
"ReturnTotalRowCounts": 1,
"DBName": "PolarDB_MySQL",
"TotalExecutionCounts": 2,
"MaxExecutionTimeMs": "60000"
}
]
},
"Engine": "polardb_mysql"
}
Error codes
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 400 | InvalidStartTime.Malformed | The specified parameter StartTime is not valid. | The specified StartTime parameter is invalid. |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.