DescribeDatabaseSlowLogRecords

更新时间:
复制 MD 格式

Retrieves slow log details for Simple Database Service.

Operation description

You can query the slow logs of a Simple Database Service instance to diagnose issues.

Note

Simple Database Service retains slow logs for 7 days.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

swas-open:DescribeDatabaseSlowLogRecords

get

*Instance

acs:swas-open:{#regionId}:{#accountId}:{#InstanceId}

None None

Request parameters

Parameter

Type

Required

Description

Example

RegionId

string

Yes

The region ID of the lightweight database instance. You can call the ListRegions operation to get the latest list of supported Alibaba Cloud regions.

cn-hangzhou

DatabaseInstanceId

string

Yes

The ID of the lightweight database instance.

db-38263fa955774501a2ae1bdaed6f****

PageNumber

integer

No

The page number.

Starting value: 1.

Default value: 1.

1

PageSize

integer

No

The number of entries per page. Valid values: 30 to 100.

Default value: 30.

30

StartTime

string

Yes

The beginning of the time range to query.

The time is in UTC and must be formatted as yyyy-MM-ddTHH:mm:ssZ as specified by the ISO 8601 standard.

Note

The console displays this time in the UTC+8 time zone.

2022-09-07T04:04:44Z

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 the end time cannot be longer than 7 days.

The time is in UTC and must be formatted as yyyy-MM-ddTHH:mm:ssZ as specified by the ISO 8601 standard.

Note

The console displays this time in the UTC+8 time zone.

2022-09-08T04:04:44Z

Response elements

Element

Type

Description

Example

object

The data returned.

RequestId

string

The request ID.

30637AD6-D977-4833-A54C-CC89483E****

PageNumber

integer

The page number of the returned page.

Starts from 1.

Default value: 1.

1

PageSize

integer

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

Default value: 30.

30

TotalCount

integer

The total number of slow query logs.

20

PhysicalIORead

integer

The number of logical reads.

200

Engine

string

The database engine.

MySQL

SlowLogs

array<object>

The slow query logs.

object

Details of slow query logs.

HostAddress

string

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

xxx[xxx] @ [1xx.xxx.xxx.xx]

QueryTimes

integer

The execution duration. Unit: seconds.

2

SQLText

string

The details of the SQL statement.

select sleep(2)

QueryTimeMS

integer

The execution duration. Unit: milliseconds.

2001

LockTimes

integer

The lock duration. Unit: seconds.

0

ExecutionStartTime

string

The start time of the execution. The time is displayed in UTC and is in the yyyy-MM-ddTHH:mm:ssZ format.

Note

The time displayed in the console is in the UTC+8 time zone, which is 8 hours later than the time in UTC.

2022-09-08T01:40:44Z

ReturnRowCounts

integer

The number of returned rows.

1

ParseRowCounts

integer

The number of parsed rows.

1

DBName

string

The database name.

testDB

Examples

Success response

JSON format

{
  "RequestId": "30637AD6-D977-4833-A54C-CC89483E****",
  "PageNumber": 1,
  "PageSize": 30,
  "TotalCount": 20,
  "PhysicalIORead": 200,
  "Engine": "MySQL",
  "SlowLogs": [
    {
      "HostAddress": "xxx[xxx] @ [1xx.xxx.xxx.xx]",
      "QueryTimes": 2,
      "SQLText": "select sleep(2)",
      "QueryTimeMS": 2001,
      "LockTimes": 0,
      "ExecutionStartTime": "2022-09-08T01:40:44Z",
      "ReturnRowCounts": 1,
      "ParseRowCounts": 1,
      "DBName": "testDB"
    }
  ]
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.