All Products
Search
Document Center

PolarDB:DescribeSlowLogs

Last Updated:Jun 17, 2024

Queries the information about the slow query logs of a PolarDB cluster.

Operation description

Note This operation is applicable only to PolarDB for MySQL clusters.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

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.
OperationAccess levelResource typeCondition keyAssociated operation
polardb:DescribeSlowLogsRead
  • dbcluster
    acs:polardb:{#regionId}:{#accountId}:dbcluster/{#dbclusterId}
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
RegionIdstringYes

The region ID of the cluster.

cn-hangzhou
DBClusterIdstringYes

The ID of cluster.

pc-****************
StartTimestringYes

The beginning of the time range to query. Specify the time in the yyyy-MM-ddZ format. The time must be in UTC.

2021-05-01Z
EndTimestringYes

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 cannot exceed 31 days. Specify the time in the yyyy-MM-ddZ format. The time must be in UTC.

2021-05-30Z
DBNamestringNo

The name of the database.

PolarDB_MySQL
PageSizeintegerNo

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

30
PageNumberintegerNo

The number of the page to return. Valid values: any non-zero positive integer.

Default value: 1.

1

Response parameters

ParameterTypeDescriptionExample
object
TotalRecordCountinteger

The total number of returned entries.

5
PageRecordCountinteger

The number of SQL statements that are returned on the current page.

6
EndTimestring

The end date of the query.

2021-05-30Z
RequestIdstring

The ID of the request.

2553A660-E4EB-4AF4-A402-8AFF70A49143
PageNumberinteger

The number of the returned page.

3
StartTimestring

The start date of the query.

2021-05-01Z
DBClusterIdstring

The ID of cluster.

pc-****************
Itemsobject []

Details about slow query logs.

SQLTextstring

The SQL statement that is executed in the query.

select id,name from tb_table
ReturnMaxRowCountlong

The largest number of rows that were returned by a specific SQL statement in the query.

3
CreateTimestring

The date when the data was generated.

2021-05-30Z
MaxExecutionTimelong

The longest execution duration of a specific SQL statement in the query. Unit: seconds.

60
ParseTotalRowCountslong

The total number of rows that were parsed by all SQL statements in the query.

2
TotalLockTimeslong

The total lock duration that was caused by all SQL statements in the query. Unit: seconds.

1
TotalExecutionTimeslong

The total duration that was caused by all SQL statements in the query. Unit: seconds.

2
DBNodeIdstring

The ID of the node.

pi-***************
SQLHASHstring

The unique ID of the SQL statement. The ID is used to obtain the slow query logs of the SQL statement.

U2FsdGVkxxxx
ParseMaxRowCountlong

The largest number of rows that were parsed by a specific SQL statement in the query.

1
MaxLockTimelong

The longest lock duration that was caused by a specific SQL statement in the query. Unit: seconds.

1
ReturnTotalRowCountslong

The total number of rows that were returned by all SQL statements in the query.

1
DBNamestring

The name of the database.

PolarDB_MySQL
TotalExecutionCountslong

The total number of executions of the SQL statements.

2
Enginestring

The type of the database engine.

polardb_mysql

Examples

Sample success responses

JSONformat

{
  "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
      }
    ]
  },
  "Engine": "polardb_mysql"
}

Error codes

HTTP status codeError codeError messageDescription
400InvalidStartTime.MalformedThe specified parameter StartTime is not valid.The specified StartTime parameter is invalid.

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2023-06-12The Error code has changedsee changesets
Change itemChange content
Error CodesThe Error code has changed.
    Added Error Codes: 400
2022-04-21Add Operationsee changesets