Queries the details of the slow query logs of a PolarDB cluster.
Operation Description
debugging
Authorization information
The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action
policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:
- Operation: the value that you can use in the Action element to specify the operation on a resource.
- Access level: the access level of each operation. The levels are read, write, and list.
- Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
- The required resource types are displayed in bold characters.
- If the permissions cannot be granted at the resource level,
All Resources
is used in the Resource type column of the operation.
- Condition Key: the condition key that is defined by the cloud service.
- Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
Operation | Access level | Resource type | Condition key | Associated operation |
---|---|---|---|---|
polardb:DescribeSlowLogRecords | READ |
|
| none |
Request parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
RegionId | string | Yes | The region ID of the cluster. Note
You can call the DescribeRegions operation to query all regions that are available for your account, such as the region ID.
| cn-hangzhou |
DBClusterId | string | Yes | The ID of cluster. Note
You can call the DescribeDBClusters operation to query information about all clusters that are deployed in a specified region, such as the cluster ID.
| pc-************ |
StartTime | string | Yes | The beginning of the time range to query. Specify the time in the Note
| 2022-11-15T16:00Z |
EndTime | string | Yes | 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 at 08:00 (UTC +8) to 12:00, set this parameter to a time value that ranges from 00:00, set this parameter to 04:00.
| 2022-11-16T04:00Z |
DBName | string | No | The name of the database. | testdb |
PageSize | integer | No | The number of entries to return on each page. Valid values:
Default value: 30. | 30 |
PageNumber | integer | No | The number of the page to return. The value must be an integer that is larger than 0. Default value: 1. | 1 |
SQLHASH | string | No | The unique ID of the SQL statement. The ID is used to obtain the slow query logs of the SQL statement. | U2FsdGVk**** |
Response parameters
Examples
Sample success responses
JSON
format
{
"TotalRecordCount": 1,
"PageRecordCount": 1,
"RequestId": "A7E6A8FD-C50B-46B2-BA85-D8B8D3******",
"PageNumber": 1,
"DBClusterId": "pc-*****************",
"Items": {
"SQLSlowRecord": [
{
"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
HTTP status code | Error code | Error message | Description |
---|---|---|---|
400 | InvalidStartTime.Malformed | The specified parameter StartTime is not valid. | The specified StartTime parameter is invalid. |
404 | InvalidDBClusterId.NotFound | The DBInstanceId provided does not exist in our records. | The specified DBClusterId parameter does not exist in the current record. |
For a list of error codes, visit the Service error codes.
Change history
Change time | Summary of changes | Operation | ||||||
---|---|---|---|---|---|---|---|---|
2023-06-12 | The error codes of the API operation change. | see changesets | ||||||
|