All Products
Search
Document Center

Database Autonomy Service:DescribeSlowLogHistogramAsync

Last Updated:Apr 18, 2026

Asynchronously retrieves the slow log trend data of an instance.

Operation description

Before you call this operation, make sure that you understand the billing methods and pricing of DAS.

The following prerequisites must be met:

  • You must enable DAS Enterprise Edition or the smart operations and maintenance (O&M) service for the instance. The smart O&M service is not yet published.

  • Use the latest version of the Alibaba Cloud SDK or the DAS SDK.

  • When you use an SDK to call the DAS service, set the region to cn-shanghai.

This is an asynchronous operation. A complete result is not returned immediately. If the isFinish parameter in the response is false, wait 1 second and call the operation again. Repeat the call until the isFinish parameter is true. Then, the complete result is returned.

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

hdm:DescribeSlowLogHistogramAsync

get

*All Resource

*

None None

Request parameters

Parameter

Type

Required

Description

Example

InstanceId

string

Yes

The ID of the database instance.

rm-2ze8g2am97624****

NodeId

string

No

The node ID.

Note

For PolarDB for MySQL instances, you must specify the node ID.

r-****-db-0

StartTime

integer

Yes

The beginning of the time range to query. Specify the time as a UNIX timestamp in milliseconds.

1596177993000

EndTime

integer

Yes

The end of the time range to query. Specify the time as a UNIX timestamp in milliseconds.

Note

The end time must be later than the start time.

1662518540764

Filters

array<object>

No

A list of query filter conditions.

object

No

The following values are supported for the Key parameter:

hostAddress: The source address. To specify multiple addresses, separate them with commas.

sqlId: The SQL ID. To specify multiple IDs, separate them with commas.

user: The username. To specify multiple usernames, separate them with commas.

dbName: The database name. To specify multiple database names, separate them with commas.

Key

string

No

The filter key.

None

Value

string

No

The value of the filter parameter.

None

Response elements

Element

Type

Description

Example

object

Code

string

The HTTP status code returned.

200

Message

string

The message returned.

Note

If the request is successful, Successful is returned. If the request fails, an error message is returned.

Successful

RequestId

string

The ID of the request.

B6D17591-B48B-4D31-9CD6-9B9796B2****

Success

string

Indicates whether the request was successful. Valid values:

  • true

  • false

true

Data

object

The detailed data of the asynchronous task.

RequestKey

string

The key of the request parameter.

ResultId

string

The ID of the asynchronous task result.

async__20ee808e72257f16a4fe024057ca****

State

string

The state of the asynchronous task. Valid values:

  • RUNNING: The task is running.

  • SUCCESS: The task is successful.

  • FAIL: The task failed.

SUCCESS

IsFinish

boolean

Indicates whether the asynchronous task is complete.

true

Data

object

The returned data.

Total

integer

The total number of entries returned.

1

Count

array

The number of slow query logs in the trend chart.

integer

The number of slow query logs.

100

Ts

array

This parameter is returned only for relational databases.

integer

The time when the first event occurred. This value is a UNIX timestamp in milliseconds.

[ 1735098480000, 1735098540000, 1735098600000, 1735098660000, 1735098720000, 1735098780000 ]

TsEnd

array

This parameter is reserved.

integer

The end timestamp of the query.

暂无

Item

array<object>

The trend metrics.

array<object>

The name of the project.

NodeId

string

The node ID.

r-bp1hi0wg57s3n0i3n8-db-0

Count

array

The number of slow query logs.

integer

The number of slow query logs.

100

InsItems

array<object>

The trend metrics.

Note

This parameter is returned only for ApsaraDB for MongoDB instances.

object

The trend metrics.

Note

This parameter is returned only for ApsaraDB for MongoDB instances.

InsId

string

The ID of the instance role.

Note

This parameter is returned only for ApsaraDB for MongoDB instances.

2492

InsRole

string

The role of the instance.

Note

This parameter is returned only for ApsaraDB for MongoDB instances.

userAdmin

Count

array

The number of executions.

integer

The number of executions.

1

TotalCount

integer

The number of slow query logs on the physical node.

10

TotalCount

integer

The total number of slow query logs.

20

InsRole

string

The role of the instance.

Note

This parameter is returned only for ApsaraDB for MongoDB instances.

Rt

array

The total execution duration, in seconds.

number

The total execution duration, in seconds.

[ 2.306, 1.141, 0.0, 4.538, 1.247, 1.972 ]

AvgRt

array

The average execution duration.

number

The average execution duration.

[ 1.593, 2.306, 1.141, 0.0, 1.5127, 1.247 ]

MaxRt

array

The maximum execution duration, in seconds.

number

The maximum execution duration, in seconds.

[ 1.593, 2.306, 1.141, 14.115 0.0, 1.972 ]

LockTime

array

The total lock wait duration, in seconds.

number

The total lock wait duration, in seconds.

[ 1.051, 1.007, 0.0, 0.755, 0.096, 0.0 ]

AvgLockTime

array

The average lock wait duration, in seconds.

number

The average lock wait duration, in seconds.

[ 1.051, 0.0, 0.3357, 0.755, 0.324, 0.814 ]

MaxLockTime

array

The maximum lock wait duration, in seconds.

number

The maximum lock wait duration, in seconds.

[ 1.051, 1.007, 0.755, 0.0, 0.05, 0.656 ]

RowsExamined

array

The total number of scanned rows.

Note

This parameter is returned for the following database engines: ApsaraDB RDS for MySQL, ApsaraDB RDS for PostgreSQL, and PolarDB for MySQL.

integer

The total number of scanned rows.

Note

This parameter is returned for the following database engines: ApsaraDB RDS for MySQL, ApsaraDB RDS for PostgreSQL, and PolarDB for MySQL.

[ 256, 1, 512, 0, 1476678, 24430 ]

AvgRowsExamined

array

The average number of scanned rows.

number

The average number of scanned rows.

[ 256.0, 256.3333, 512.0, 370860.1111, 0.0, 1.0 ]

MaxRowsExamined

array

The maximum number of scanned rows.

integer

The maximum number of scanned rows.

[ 256, 1, 512, 0, 1476678, 24430 ]

RowsSent

array

The number of returned rows.

integer

The number of returned rows.

[ 384, 256, 0, 207030, 4, 256 ]

AvgRowsSent

array

The average number of returned rows.

number

The average number of returned rows.

[ 128.0, 0.0, 256.0, 25878.75, 192.0, 72.7778 ]

MaxRowsSent

array

The maximum number of returned rows.

integer

The maximum number of returned rows.

[ 256, 207023, 0, 128, 0, 0 ]

KeysExamined

array

The number of scanned index rows.

Note

This parameter is returned only for ApsaraDB for MongoDB instances.

integer

The number of scanned index rows.

Note

This parameter is returned only for ApsaraDB for MongoDB instances.

[ 384, 256, 0, 207030, 4, 256 ]

AvgKeysExamined

array

The average number of scanned index rows.

Note

This parameter is returned only for ApsaraDB for MongoDB instances.

number

The average number of scanned index rows.

Note

This parameter is returned only for ApsaraDB for MongoDB instances.

[ 128.0, 0.0, 256.0, 25878.75, 192.0, 72.7778 ]

MaxKeysExamined

array

The maximum number of scanned index rows.

Note

This parameter is returned only for ApsaraDB for MongoDB instances.

integer

The maximum number of scanned index rows.

Note

This parameter is returned only for ApsaraDB for MongoDB instances.

[ 384, 256, 0, 207030, 4, 256 ]

DocExamined

array

The number of scanned documents.

Note

This parameter is returned only for ApsaraDB for MongoDB instances.

integer

The number of scanned documents.

Note

This parameter is returned only for ApsaraDB for MongoDB instances.

[ 256, 207023, 0, 128, 0, 0 ]

AvgDocExamined

array

The average number of scanned documents.

Note

This parameter is returned only for ApsaraDB for MongoDB instances.

number

The average number of scanned documents.

Note

This parameter is returned only for ApsaraDB for MongoDB instances.

[ 128.0, 0.0, 256.0, 25878.75, 192.0, 72.7778 ]

MaxDocExamined

array

The maximum number of scanned documents.

Note

This parameter is returned only for ApsaraDB for MongoDB instances.

integer

The maximum number of scanned documents.

Note

This parameter is returned only for ApsaraDB for MongoDB instances.

[ 256, 207023, 0, 128, 0, 0 ]

ReturnNum

array

The number of returned rows.

Note

This parameter is returned only for ApsaraDB for MongoDB instances.

integer

The number of returned rows.

Note

This parameter is returned only for ApsaraDB for MongoDB instances.

[ 256, 207023, 0, 128, 0, 0 ]

AvgReturnNum

array

The average number of returned rows.

Note

This parameter is returned only for ApsaraDB for MongoDB instances.

number

The average number of returned rows

Note

This parameter is returned only for ApsaraDB for MongoDB instances.

[ 128.0, 0.0, 256.0, 25878.75, 192.0, 72.7778 ]

MaxReturnNum

array

The maximum number of returned rows.

Note

This parameter is returned only for ApsaraDB for MongoDB instances.

integer

The maximum number of returned rows.

Note

This parameter is returned only for ApsaraDB for MongoDB instances.

[ 256, 207023, 0, 128, 0, 0 ]

IOWrites

array

The number of I/O writes.

Note

This parameter is returned only for ApsaraDB RDS for SQL Server instances.

integer

The number of I/O writes.

Note

This parameter is returned only for ApsaraDB RDS for SQL Server instances.

[ 256, 207023, 0, 128, 0, 0 ]

AvgIOWrites

array

The average number of I/O writes.

Note

This parameter is returned only for ApsaraDB RDS for SQL Server instances.

number

The average number of I/O writes.

Note

This parameter is returned only for ApsaraDB RDS for SQL Server instances.

[ 384, 256, 0, 207030, 4, 256 ]

MaxIOWrites

array

The maximum number of I/O writes.

Note

This parameter is returned only for ApsaraDB RDS for SQL Server instances.

integer

The maximum number of I/O writes.

Note

This parameter is returned only for ApsaraDB RDS for SQL Server instances.

[ 256, 1, 512, 0, 1476678, 24430 ]

LastRowsCountAffected

array

The number of rows affected by the last statement.

Note

This parameter is returned only for ApsaraDB RDS for SQL Server instances.

integer

The number of rows affected by the last statement.

Note

This parameter is returned only for ApsaraDB RDS for SQL Server instances.

[ 256, 207023, 0, 128, 0, 0 ]

AvgLastRowsCountAffected

array

The average number of rows affected by the last statement.

Note

This parameter is returned only for ApsaraDB RDS for SQL Server instances.

number

The average number of rows affected by the last statement.

Note

This parameter is returned only for ApsaraDB RDS for SQL Server instances.

[ 1.593, 2.306, 1.141, 0.0, 1.5127, 1.247 ]

MaxLastRowsCountAffected

array

The maximum number of rows affected by the last statement.

Note

This parameter is returned only for ApsaraDB RDS for SQL Server instances.

integer

The average number of rows affected by the last statement.

Note

This parameter is returned only for ApsaraDB RDS for SQL Server instances.

[ 1, 1, 3, 1, 2, 3 ]

LogicalIOReads

array

The number of logical reads.

Note

This parameter is returned only for ApsaraDB RDS for SQL Server instances.

integer

The number of logical reads.

Note

This parameter is returned only for ApsaraDB RDS for SQL Server instances.

[ 384, 256, 0, 207030, 4, 256 ]

AvgLogicalIOReads

array

The average number of logical reads.

Note

This parameter is returned only for ApsaraDB RDS for SQL Server instances.

number

The average number of logical reads.

Note

This parameter is returned only for ApsaraDB RDS for SQL Server instances.

[ 1.593, 2.306, 1.141, 0.0, 1.5127, 1.247 ]

MaxLogicalIOReads

array

The maximum number of logical reads.

Note

This parameter is returned only for ApsaraDB RDS for SQL Server instances.

integer

The maximum number of logical reads.

Note

This parameter is returned only for ApsaraDB RDS for SQL Server instances.

[ 124, 2, 24, 251, 191, 721 ]

PhysicalIOReads

array

The number of physical reads.

Note

This parameter is returned only for ApsaraDB RDS for SQL Server instances.

integer

The number of physical reads.

Note

This parameter is returned only for ApsaraDB RDS for SQL Server instances.

[ 324, 22, 254, 251, 191, 721 ]

AvgPhysicalIOReads

array

The average number of physical reads.

Note

This parameter is returned only for ApsaraDB RDS for SQL Server instances.

number

The average number of physical reads.

Note

This parameter is returned only for ApsaraDB RDS for SQL Server instances.

[ 128.0, 0.0, 256.0, 25878.75, 192.0, 72.7778 ]

MaxPhysicalIOReads

array

The maximum number of physical reads.

Note

This parameter is returned only for ApsaraDB RDS for SQL Server instances.

integer

The maximum number of physical reads.

Note

This parameter is returned only for ApsaraDB RDS for SQL Server instances.

[ 314, 242, 114, 351, 191, 721 ]

RowsCountAffected

array

The number of affected rows.

Note

This parameter is returned only for ApsaraDB RDS for SQL Server instances.

integer

The number of affected rows.

Note

This parameter is returned only for ApsaraDB RDS for SQL Server instances.

[ 34, 42, 14, 51, 91, 71 ]

AvgRowsCountAffected

array

The average number of affected rows.

Note

This parameter is returned only for ApsaraDB RDS for SQL Server instances.

number

The average number of affected rows.

Note

This parameter is returned only for ApsaraDB RDS for SQL Server instances.

[ 1.593, 2.306, 1.141, 14.115, 0.0, 1.783, 0.0, 1.972 ]

MaxRowsCountAffected

array

The maximum number of affected rows.

Note

This parameter is returned only for ApsaraDB RDS for SQL Server instances.

integer

The maximum number of affected rows.

Note

This parameter is returned only for ApsaraDB RDS for SQL Server instances.

[ 714, 442, 314, 151, 291, 521 ]

CPUTime

array

The CPU time, in seconds.

Note

This parameter is returned only for ApsaraDB RDS for SQL Server instances.

number

The CPU time, in seconds.

Note

This parameter is returned only for ApsaraDB RDS for SQL Server instances.

[ 1.051, 1.007, 0.755, 0.0, 0.05, 0.656 ]

AvgCPUTime

array

The average CPU time, in seconds.

Note

This parameter is returned only for ApsaraDB RDS for SQL Server instances.

number

The average CPU time, in seconds.

Note

This parameter is returned only for ApsaraDB RDS for SQL Server instances.

[ 2.306, 1.141, 0.0, 4.538, 1.247, 0.0 ]

MaxCPUTime

array

The maximum CPU time, in seconds.

Note

This parameter is returned only for ApsaraDB RDS for SQL Server instances.

number

The maximum CPU time, in seconds.

Note

This parameter is returned only for ApsaraDB RDS for SQL Server instances.

[ 2.306, 1.141, 0.0, 4.538, 1.247, 0.0 ]

Rows

array

The total number of updated or returned rows on the compute nodes of a PolarDB-X 2.0 instance.

Note

This parameter is returned only for PolarDB-X 2.0 instances.

integer

The total number of updated or returned rows on the compute nodes of a PolarDB-X 2.0 instance.

Note

This parameter is returned only for PolarDB-X 2.0 instances.

[]

AvgRows

array

The average number of rows.

number

The average number of rows.

MaxRows

array

The maximum number of rows.

integer

The maximum number of rows.

Frows

array

The number of rows pulled by the compute nodes (CNs) of a PolarDB-X 2.0 instance.

Note

This parameter is returned only for PolarDB-X 2.0 instances.

integer

The number of rows pulled by the CNs of a PolarDB-X 2.0 instance.

Note

This parameter is returned only for PolarDB-X 2.0 instances.

AvgFrows

array

The average number of pulled rows.

number

The average number of pulled rows.

MaxFrows

array

The maximum number of pulled rows.

integer

The maximum number of pulled rows.

Scnt

array

The number of requests sent from the compute nodes (CNs) to the data nodes (DNs) of a PolarDB-X 2.0 instance.

Note

This parameter is returned only for PolarDB-X 2.0 instances.

integer

The number of requests sent from the CNs to the DNs of a PolarDB-X 2.0 instance.

Note

This parameter is returned only for PolarDB-X 2.0 instances.

AvgScnt

array

The average number of requests.

number

The average number of requests.

MaxScnt

array

The maximum number of requests.

integer

The maximum number of requests.

TotalCount

integer

The total number of slow query logs.

5

ErrorCode

integer

The error code.

10910

Message

string

The error message.

Successful

Timestamp

integer

The time when the request was made.

1645668213000

Examples

Success response

JSON format

{
  "Code": "200",
  "Message": "Successful",
  "RequestId": "B6D17591-B48B-4D31-9CD6-9B9796B2****",
  "Success": "true",
  "Data": {
    "RequestKey": "无",
    "ResultId": "async__20ee808e72257f16a4fe024057ca****",
    "State": "SUCCESS",
    "IsFinish": true,
    "Data": {
      "Total": 1,
      "Count": [
        100
      ],
      "Ts": [
        0
      ],
      "TsEnd": [
        0
      ],
      "Item": [
        {
          "NodeId": "r-bp1hi0wg57s3n0i3n8-db-0",
          "Count": [
            100
          ],
          "InsItems": [
            {
              "InsId": "2492",
              "InsRole": "userAdmin",
              "Count": [
                1
              ],
              "TotalCount": 10
            }
          ],
          "TotalCount": 20,
          "InsRole": ""
        }
      ],
      "Rt": [
        0
      ],
      "AvgRt": [
        0
      ],
      "MaxRt": [
        0
      ],
      "LockTime": [
        0
      ],
      "AvgLockTime": [
        0
      ],
      "MaxLockTime": [
        0
      ],
      "RowsExamined": [
        0
      ],
      "AvgRowsExamined": [
        0
      ],
      "MaxRowsExamined": [
        0
      ],
      "RowsSent": [
        0
      ],
      "AvgRowsSent": [
        0
      ],
      "MaxRowsSent": [
        0
      ],
      "KeysExamined": [
        0
      ],
      "AvgKeysExamined": [
        0
      ],
      "MaxKeysExamined": [
        0
      ],
      "DocExamined": [
        0
      ],
      "AvgDocExamined": [
        0
      ],
      "MaxDocExamined": [
        0
      ],
      "ReturnNum": [
        0
      ],
      "AvgReturnNum": [
        0
      ],
      "MaxReturnNum": [
        0
      ],
      "IOWrites": [
        0
      ],
      "AvgIOWrites": [
        0
      ],
      "MaxIOWrites": [
        0
      ],
      "LastRowsCountAffected": [
        0
      ],
      "AvgLastRowsCountAffected": [
        0
      ],
      "MaxLastRowsCountAffected": [
        0
      ],
      "LogicalIOReads": [
        0
      ],
      "AvgLogicalIOReads": [
        0
      ],
      "MaxLogicalIOReads": [
        0
      ],
      "PhysicalIOReads": [
        0
      ],
      "AvgPhysicalIOReads": [
        0
      ],
      "MaxPhysicalIOReads": [
        0
      ],
      "RowsCountAffected": [
        0
      ],
      "AvgRowsCountAffected": [
        0
      ],
      "MaxRowsCountAffected": [
        0
      ],
      "CPUTime": [
        0
      ],
      "AvgCPUTime": [
        0
      ],
      "MaxCPUTime": [
        0
      ],
      "Rows": [
        0
      ],
      "AvgRows": [
        0
      ],
      "MaxRows": [
        0
      ],
      "Frows": [
        0
      ],
      "AvgFrows": [
        0
      ],
      "MaxFrows": [
        0
      ],
      "Scnt": [
        0
      ],
      "AvgScnt": [
        0
      ],
      "MaxScnt": [
        0
      ],
      "TotalCount": 5
    },
    "ErrorCode": 10910,
    "Message": "Successful",
    "Timestamp": 1645668213000
  }
}

Error codes

HTTP status code

Error code

Error message

Description

400 InvalidParams The request parameters are invalid.
403 NoPermission You are not authorized to do this action.

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.