DescribeSqlInsightStatistic

Updated at:

Invokes the DescribeSqlInsightStatistic operation to perform aggregation on SQL Explorer data for a specified instance within a given time window by dimensions such as SQL template, access source, or database user.

Operation description

Before calling this operation, ensure that the following prerequisites are met:

  • If you use the Alibaba Cloud or DAS SDK, use the latest version.

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

  • The SQL Explorer feature must be enabled for the target instance. Otherwise, the operation returns an error.

Usage notes:

  • This operation is asynchronous. The first time you invoke this operation, it returns ResultId and State. You must use polling with the exact same request parameters until State is SUCCESS to obtain the statistical results in Data.

  • StartTime and EndTime are both millisecond-level UNIX timestamps. The interval between StartTime and the current time cannot exceed 30 days, and the interval between StartTime and EndTime cannot exceed 7 days.

  • Due to data aggregation delays, EndTime is automatically truncated to a few minutes before the current time. Data from the most recent minutes may not be queried.

  • StartTime is automatically converged to a time no earlier than the time when the SQL Explorer feature was enabled for the instance.

Response description:

  • Data.Data.List contains the aggregated statistical results grouped by dimension. Each element corresponds to an SQL template category or an aggregation key, rather than a detailed record of a single execution.

  • Scnt, AvgScnt, Rows, AvgRows, Frows, and AvgFrows are metrics specific to PolarDB-X compute nodes and are returned only when Role is polarx_cn.

  • Writes, AvgWrites, MaxWrites, MinWrites, PhysicalRead, AvgPhysicalRead, MaxPhysicalRead, MinPhysicalRead, CpuTime, AvgCpuTime, MaxCpuTime, and MinCpuTime are metrics specific to SQL Server instances.

  • Trend is returned only when the request parameter DoFillTrend is set to true and the trend filling capability is enabled for the instance. The time slice interval is automatically determined by the query span.

  • SQL sample dimension fields such as SqlNew, Params, FirstTime, and Extra are not returned by this operation. This operation provides aggregated statistics at the template dimension.

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:DescribeSqlInsightStatistic

get

*All Resource

*

None None

Request parameters

Parameter

Type

Required

Description

Example

ConsoleContext

string

No

The reserved parameter.

null

InstanceId

string

Yes

The database instance ID.

Note

This operation supports ApsaraDB RDS for MySQL, PolarDB for MySQL, PolarDB-X, ApsaraDB RDS for PostgreSQL, PolarDB for PostgreSQL, ApsaraDB RDS for SQL Server, and Lindorm instances that have the SQL Explorer feature enabled. MongoDB and Redis instances are not supported. If you invoke this operation for them, an unsupported operation error is returned.

rm-bp1q6f9z5xxxxxxxx

NodeId

string

No

The ID of the node in the instance. This parameter is used to narrow the statistical scope to the specified node. Only a single node ID is supported. Multiple node IDs separated by commas are not supported.

Note

This parameter is required only for multi-node instances such as PolarDB-X and Lindorm. You can ignore this parameter for single-node instances.

pi-bp1xxxxxxxxxxxx

Type

string

No

The aggregation or filtering dimension for statistics. The value is not case-sensitive. If this parameter is not specified, the default aggregation dimension is the SQL template. Valid values:

  • FullRequestOrigin: aggregates data by access source address.

  • FullRequestUser: aggregates data by database user.

  • SQL: filters data by SQL template. You must also specify TemplateId as the SQL template ID.

  • OriginHost: filters data by access source. You must also specify TemplateId as the source address.

  • User: filters data by database user. You must also specify TemplateId as the username.

Note

If you specify a value other than the preceding values, an InvalidParams error is returned.

SQL

TemplateId

string

No

The identifier of the statistical object. The meaning varies based on the value of Type. Valid values:

  • When Type is set to SQL: specify the SQL template ID, which is the SqlId in the response.

  • When Type is set to OriginHost: specify the access source address.

  • When Type is set to User: specify the database username.

Note

This parameter does not take effect when Type is empty, FullRequestOrigin, or FullRequestUser.

Note

When Type is set to SQL, you can specify multiple template IDs separated by commas. In this case, Keyword does not take effect.

9f8e7d6c5b4a3210

Keyword

string

No

The keyword used to retrieve SQL template content through fuzzy match. Separate multiple keywords with spaces. The system first performs a keyword match based on the keywords to obtain the corresponding SQL templates (up to 1,000 templates) and then performs aggregation statistics based on these templates. If no matching template is found, an empty list is returned.

Note

This parameter does not take effect when Type is set to SQL and TemplateId is specified.

t_order

StartTime

integer

Yes

The start time of the query. The value is a UNIX timestamp in milliseconds. The system rounds down the value to the nearest minute.

Note

The interval between the start time and the current time cannot exceed 30 days. If the start time is earlier than the time when the SQL Explorer feature was enabled for the instance, the start time is automatically converged to the enabling time.

1718000000000

EndTime

integer

Yes

The end time of the query. The value is a UNIX timestamp in milliseconds. The system rounds up the value to the nearest minute.

Note

The interval between EndTime and StartTime cannot exceed 7 days. If EndTime is earlier than the time when the SQL Explorer feature was enabled for the instance, an error indicating that the query time is earlier than the available time is returned.

Note

Due to data aggregation delays, the actual effective value is truncated to a few minutes before the current time. Therefore, data from the most recent minutes may not be queried.

1718600000000

OrderBy

string

No

The field used for sorting. If this parameter is not specified or an unsupported value is specified, the data is sorted by rt (total response time). Valid values:

  • Response time: rt, avgRt, maxRt, minRt, and rtRate.

  • Executions: count, countRate, and timestamp.

  • Scanned rows: rowsExamined and avgRowsExamined.

  • Returned rows: rowsReturned, totalRowsReturned, avgRowsReturned, maxRowsReturned, minRowsReturned, maxRowReturned, and minRowReturned.

  • Logical reads: logicalRead, totalLogicalRead, avgLogicalRead, maxLogicalRead, and minLogicalRead.

  • Physical reads: physicalRead, totalPhysicalRead, avgPhysicalRead, maxPhysicalRead, and minPhysicalRead.

  • Logical writes (valid only for SQL Server instances): writes, totalWrites, avgWrites, maxWrites, and minWrites.

  • CPU time (valid only for SQL Server instances): totalCpuTime, avgCpuTime, maxCpuTime, and minCpuTime.

  • PolarDB-X compute nodes (valid only when Role is set to polarx_cn): scnt, avgScnt, rows, avgRows, frows, and avgFrows.

  • Affected rows (valid only for Lindorm instances): totalAffectRows and avgAffectRows.

Note

timestamp indicates that the data is sorted by data timestamp, which is a UNIX timestamp in milliseconds.

Note

Only the first letter is case-insensitive. The remaining characters must exactly match the preceding values. For example, AvgRt is valid, but avgrt is invalid.

rt

Asc

boolean

No

The sorting order. Default value: false (descending order). Valid values:

  • true: ascending order.

  • false: descending order.

false

PageNo

integer

No

The page number. Pages start from 1. Default value: 1.

1

PageSize

integer

No

The number of statistical entries to return on each page. If this parameter is not specified, the default value is 10. The maximum value is 2000.

Note

If the value exceeds 2000, an InvalidParams error is returned instead of being truncated.

Note

When data is aggregated by access source or database user (when Type is set to FullRequestOrigin or FullRequestUser), a value greater than 100 is reset to 10 in some aggregation storage links.

20

DoFillTrend

boolean

No

Specifies whether to fill time series trend data for each statistical result, which corresponds to the Trend field in the response. Default value: true. Valid values:

  • true: fills trend data.

  • false: does not fill trend data.

Note

If this parameter is set to true, the system additionally queries data for each time slice for each result, which significantly increases the query overhead. If the trend filling capability is not enabled for the instance, this parameter does not take effect.

true

SqlType

string

No

The SQL type used for filtering. Valid values:

  • select

  • insert

  • update

  • delete

Note

The value must be in lowercase. In the aggregation storage links of some instances, you can specify multiple values separated by commas. In other links, you can specify only a single value.

select

DbName

string

No

The database name used for filtering.

Note

In the aggregation storage links of some instances, you can specify multiple database names separated by commas. In other links, you can specify only a single database name.

db_test

Role

string

No

The role of the instance node. The value is not case-sensitive. If this parameter is not specified, the value is automatically parsed based on InstanceId. Valid values:

  • polarx_cn: PolarDB-X compute node.

  • polarx_dn: PolarDB-X storage node.

Note

This value affects the filling scope of the returned fields. For example, Scnt, Rows, and Frows are returned only when the value is polarx_cn.

polarx_cn

JobId

string

No

The idempotent ID for querying SQL Explorer data. You do not need to specify this parameter for common queries.

9a4f5c4494dbd6713185d87a97aa53e8

Filters

array<object>

No

The list of structured filter conditions. The conditions are passed as key-value pairs. The POP format is Filters.N.Key and Filters.N.Value. A maximum of 100 pairs can be specified. Key is not case-sensitive. Entries with an empty Value are ignored. Valid values of Key that take effect in this operation:

  • keyWord: the keyword. It is split into multiple words by whitespace characters and takes effect together with the Keyword parameter.

  • hostAddress: the access source address. Multiple addresses are separated by commas. It takes effect together with TemplateId when Type is set to OriginHost.

  • accountName: the database username. Multiple usernames are separated by commas.

  • dbName: the database name. Multiple names are separated by commas. It takes effect together with the DbName parameter.

  • sqlType: the SQL type. Multiple types are separated by commas. It takes effect together with the SqlType parameter.

  • sqlId: the SQL template ID. Multiple IDs are separated by commas. It takes effect together with TemplateId when Type is set to SQL.

  • insRole: the primary/secondary role. Valid values are master and slave. This value is case-sensitive.

Note

If you specify a Key other than the preceding values, it is ignored.

Note

This parameter takes effect only in the aggregation storage links of some instances. It is completely ignored in other links.

object

No

Key

string

No

The key of the conditional filter. The key is not case-sensitive. For valid values, see the description of the Filters parameter.

sqlType

Value

string

No

The value of the filter condition. If the value is null or an empty string, the filter condition is ignored. Multiple values are separated by commas. The specific upper limit depends on the corresponding key.

select

Response elements

Element

Type

Description

Example

object

Code

string

The response status code.

200

Data

object

The envelope for the asynchronous query result. The first call returns ResultId and State. You must poll the API with the exact same request parameters until State is SUCCESS, and then retrieve the statistical details from List.

Data

object

The SQL Explorer statistical query result.

Note

Returned only when State is SUCCESS.

Extra

any

The extended information.

Note

This operation does not return this field.

{}

List

array<object>

The list of SQL Explorer statistical results. Each element is a statistical entry under an aggregation dimension.

array<object>

AffectRows

integer

The number of affected rows for a single SQL statement. For SELECT statements, this indicates the number of scanned rows. For DML statements, this indicates the number of affected rows.

Note

Returned only for Lindorm instances.

30

AggKey

string

The value of the aggregation dimension for the current statistics. This value varies based on the Type request parameter. Valid values:

  • When aggregated by SQL template: the SQL template ID, which is the same as SqlId.

  • When Type is FullRequestOrigin: the source access address.

  • When Type is FullRequestUser: the database username.

651b56fe9418d48edb8fdf0980ec****

AvgAffectRows

number

The average number of affected rows.

Note

Returned only for Lindorm instances. For other engines, the value is null.

30.2

AvgCpuTime

number

The average CPU time consumed by SQL execution, in microseconds.

Note

This is an exclusive metric for SQL Server instances. For other engines, the value is null.

12.5

AvgFrows

number

The average number of rows fetched by PolarDB-X compute nodes from data nodes.

Note

This is an exclusive metric for PolarDB-X compute nodes. For other engines, the value is null or 0.

10

AvgLockWaitTime

number

The average lock wait time per execution, in milliseconds.

Note

Data is available only when Version is 1.

0.00009589874265269765

AvgLogicalRead

number

The average number of logical reads per execution.

Note

Data is available only when Version is 1.

654.4470327860251

AvgPhysicalAsyncRead

number

The average number of physical asynchronous reads per execution.

Note

Data is available only when Version is 1.

0

AvgPhysicalRead

number

The average number of physical reads.

Note

This is an exclusive metric for SQL Server instances. For other engines, the value is null.

654.4

AvgPhysicalSyncRead

number

The average number of physical synchronous reads per execution.

Note

Data is available only when Version is 1.

0

AvgRows

number

The average number of updated and returned rows for PolarDB-X compute nodes.

Note

This is an exclusive metric for PolarDB-X compute nodes. For other engines, the value is null or 0.

10

AvgRowsExamined

number

The average number of scanned rows per execution.

53421.0

AvgRowsReturned

number

The average number of returned rows per execution.

14

AvgRowsUpdated

number

The average number of updated rows per execution.

30.2

AvgRt

number

The average execution time, in milliseconds.

2.499

AvgScanRows

number

The average number of scanned rows.

Note

This operation does not return this field. Use AvgRowsExamined for the average number of scanned rows.

53421.0

AvgScnt

number

The average number of requests sent from PolarDB-X compute nodes to data nodes.

Note

This is an exclusive metric for PolarDB-X compute nodes. For other engines, the value is null or 0.

10

AvgWrites

number

The average number of logical writes.

Note

This is an exclusive metric for SQL Server instances. For other engines, the value is null.

10

Count

integer

The total number of executions for the SQL template within the statistical interval.

127

CountRate

number

The ratio of the executions in this statistic to the total number of SQL statements that execute on the instance. Valid values: 0 to 1.

0.0586

CpuTime

integer

The total CPU time consumed by SQL execution, in microseconds.

Note

This is an exclusive metric for SQL Server instances. For other engines, the value is null.

100

Database

string

The name of the database where the SQL statement is executed.

dbtest01

ErrorCode

string

The error code returned by the SQL execution.

Note

Error codes belong to the details of a single SQL statement. This operation returns aggregated statistics at the template dimension and does not return this field. Use ErrorCount for error statistics.

1146

ErrorCount

integer

The number of execution errors for the SQL template within the statistical interval.

1

FirstTime

integer

The time when the SQL template first appeared. The time is a UNIX timestamp in milliseconds.

Note

This operation does not return this field.

1659308149000

Frows

integer

The total number of rows fetched by PolarDB-X compute nodes from data nodes.

Note

This is an exclusive metric for PolarDB-X compute nodes. For other engines, the value is null or 0.

10

Hash

string

The hash value of the SQL template, returned together with the SQL template.

Note

This value is generated by the kernel of PolarDB-X compute nodes. For instances that are not PolarDB-X compute nodes, the value is empty.

2e8147b5ca2dfc640dfd5e43d96a****

Ip

string

The endpoint of the instance to which the statistical data belongs.

Note

Whether this field is returned depends on the aggregated storage link of the instance. For some links, the value is null.

rm-2ze1jdv45i7l6****.mysql.rds.aliyuncs.com

LockWaitTime

number

The total lock wait time, in milliseconds.

Note

Data is available only when Version is 1.

1089.4177720290281

LogicalRead

number

The total number of logical reads.

Note

Data is available only when Version is 1.

165848

MaxCpuTime

integer

The maximum CPU time in a single execution, in microseconds.

Note

This is an exclusive metric for SQL Server instances. For other engines, the value is null.

30

MaxLogicalRead

integer

The maximum number of logical reads in a single execution.

Note

Data is available only when Version is 1.

3186

MaxPhysicalRead

integer

The maximum number of physical reads in a single execution.

Note

This is an exclusive metric for SQL Server instances. For other engines, the value is null.

3186

MaxRowsExamined

integer

The maximum number of scanned rows in a single execution.

Note

This operation does not return this field. Use RowsExamined and AvgRowsExamined for the number of scanned rows.

318613

MaxRowsReturned

integer

The maximum number of returned rows in a single execution.

20

MaxRt

number

The maximum execution time in a single execution, in milliseconds.

12.499

MaxWrites

integer

The maximum number of logical writes in a single execution.

Note

This is an exclusive metric for SQL Server instances. For other engines, the value is null.

12

MinCpuTime

integer

The minimum CPU time in a single execution, in microseconds.

Note

This is an exclusive metric for SQL Server instances. For other engines, the value is null.

5

MinLogicalRead

integer

The minimum number of logical reads in a single execution.

Note

Data is available only when Version is 1.

12

MinPhysicalRead

integer

The minimum number of physical reads in a single execution.

Note

This is an exclusive metric for SQL Server instances. For other engines, the value is null.

12

MinRowsReturned

integer

The minimum number of returned rows in a single execution.

1

MinRt

number

The minimum execution time in a single execution, in milliseconds.

0.409789

MinWrites

integer

The minimum number of logical writes in a single execution.

Note

This is an exclusive metric for SQL Server instances. For other engines, the value is null.

8

OriginAlias

string

The display alias configured for the source access address.

Note

Returned only when aggregated by access source (when Type is FullRequestOrigin). For other scenarios, the value is null.

order-1

OriginHost

string

The source address of the client that initiated the SQL statement.

Note

When Type is FullRequestOrigin, this field is the aggregation dimension for the statistic.

172.26.XX.XXX

Params

string

The parameter content of the SQL sample.

Note

This operation returns aggregated statistics at the template dimension and does not return this field.

[1, "das"]

PhysicalAsyncRead

number

The total number of physical asynchronous reads.

Note

Data is available only when Version is 1.

0

PhysicalRead

integer

The total number of physical reads.

Note

This is an exclusive metric for SQL Server instances. For other engines, the value is null.

165848

PhysicalSyncRead

number

The total number of physical synchronous reads.

Note

Data is available only when Version is 1.

0

Port

integer

The connection port of the instance to which the statistical data belongs.

Note

Whether this field is returned depends on the aggregated storage link of the instance. For some links, the value is null.

3306

Psql

string

The parameterized SQL template text, which is the statement with constants in the SQL replaced by placeholders.

select * from t_order where id = ?

Rows

integer

The total number of updated and returned rows on PolarDB-X compute nodes.

Note

This is an exclusive metric for PolarDB-X compute nodes. For other engines, the value is null or 0.

10

RowsExamined

integer

The total number of scanned rows for the SQL template within the statistical period.

2048576

RowsReturned

integer

The total number of returned rows for the SQL template within the statistical period.

14

Rt

number

The total execution duration for the SQL template within the statistical period, in milliseconds.

Note

For PolarDB-X compute nodes (where Role is polarx_cn) with a kernel version earlier than 5.4.13, this value is converted from microseconds to milliseconds.

0.409789

RtGreaterThanOneSecondCount

integer

The number of times the SQL statement takes more than 1 second to execute.

Note

Whether this field is returned depends on the aggregated storage link of the instance. The value may be null for some links.

20

RtRate

number

The ratio of the total execution duration of this record to the total execution duration of all SQL statements on the instance. Valid values: 0 to 1.

0.1384

SampleType

string

The type identifier of the sample data.

Note

This operation returns aggregated statistics and does not return this field.

sql

ScanRows

integer

The number of scanned rows for a single SQL statement.

Note

This operation returns aggregated statistics at the template level and does not return this field. Use the aggregated metrics RowsExamined and AvgRowsExamined instead.

29

Scnt

integer

The total number of requests sent from PolarDB-X compute nodes to data nodes.

Note

This is an exclusive metric for PolarDB-X compute nodes. For other engines, the value is null or 0.

10

Sql

string

The original SQL text.

Note

The statistical results return the SQL template (Psql) and do not return this field.

select * from t_order where id = 1

SqlId

string

The SQL template ID, which uniquely identifies a type of parameterized SQL statement. Multiple executions under the same template are aggregated into a single statistical record. You can use this ID to associate the same type of SQL statement across multi-dimensional queries.

651b56fe9418d48edb8fdf0980ec****

SqlNew

string

The SQL text with unified processing applied to parameter values, used in sample data scenarios.

Note

This operation does not return this field.

select * from t_order where id = ?

SqlTextFeature

string

The SQL text feature value, used in SQL analysis scenarios.

Note

This operation does not return this field.

select_from_t_order

SqlType

string

The SQL type. Valid values:

  • select

  • insert

  • update

  • delete

  • other

select

SumRowsUpdated

number

The total number of updated rows for the SQL template within the statistical period.

3810

Tables

array

The list of table names involved in the SQL statement.

string

The name of a table involved in the SQL statement.

t_order

ThreadId

string

The database thread ID that executed the SQL statement.

Note

The thread ID belongs to the details of a single SQL statement. This operation returns aggregated statistics at the template level and does not return this field.

57472578

TimeRate

number

The execution duration proportion.

Note

This operation returns the execution duration proportion through RtRate and does not return this field.

0.1384

Timestamp

integer

The data timestamp, which is a UNIX timestamp in milliseconds.

Note

The statistical results are aggregated at the SQL template level and do not return this field.

1718600000000

TotalAffectRows

integer

The total number of affected rows.

Note

This field is returned only for Lindorm instances. For other engines, the value is null.

3810

TotalRt

integer

The total execution duration of the SQL statement.

Note

This operation does not return this field. Use Rt for the total execution duration.

310

TotalScanRows

integer

The total number of scanned rows.

Note

This operation does not return this field. Use RowsExamined for the total number of scanned rows.

2048576

Trend

array<object>

The trend sequence of the number of times the SQL statements execute within the query time window, divided by time slices.

Note

This field is returned only when the request parameter DoFillTrend is set to true and the trend padding feature is enabled for the instance. The time slice interval is automatically determined by the query span. Time slices with no data may be padded with zeros.

object

Timestamp

integer

The timestamp of the trend point, which is a UNIX timestamp in milliseconds.

1718000000000

Value

any

The number of SQL executions within the time slice.

12

UpdateRows

integer

The number of updated rows for a single SQL statement.

Note

This operation returns aggregated statistics at the template level and does not return this field. Use the aggregated metrics SumRowsUpdated and AvgRowsUpdated instead.

30

User

string

The database username that executed the SQL statement.

Note

When Type is FullRequestUser, this field is the aggregation dimension for the statistical record.

testUser

Version

integer

The version of the SQL Explorer data collection link. The value 1 is returned when the instance collects logical read or lock wait data. Otherwise, 0 is returned. Valid values:

  • 0: V0 basic collection link.

  • 1: V1 collection link, which collects four additional metrics (LockWaitTime, LogicalRead, PhysicalSyncRead, and PhysicalAsyncRead) based on V0.

Note

When 0 is returned, the preceding extended metrics have no data.

1

VpcId

string

The VPC ID of the instance to which the statistical data belongs.

Note

Whether this field is returned depends on the aggregated storage link of the instance. The value may be null for some links.

vpc-2zentqj1sk4qmolci****

Writes

integer

The total number of logical writes.

Note

This is an exclusive metric for SQL Server instances. For other engines, the value is null.

10

PageNo

integer

The current page number, which corresponds to the request parameter PageNo.

1

PageSize

integer

The number of entries returned per page, which corresponds to the request parameter PageSize.

10

Total

integer

The total number of statistical entries that meet the query conditions, which can be used for pagination.

10

ErrorCode

integer

The error code returned when the asynchronous query fails.

Note

This field is returned only when the query fails.

-10200020

IsFinish

boolean

Indicates whether the asynchronous query has finished. Valid values:

  • true: State is SUCCESS or FAIL.

  • false: State is RUNNING.

Message

string

The error description returned when the asynchronous query fails.

Note

This field is returned only when the query fails.

startTime must be in 30 days and the interval must be within 7 day

RequestKey

string

The hash identifier of the request parameters.

Note

This operation does not return this field. Use ResultId to identify the asynchronous query.

507044db6c4eadfa2dab9b084e80****

ResultId

string

The asynchronous query result ID, which is in the format of an async_ prefix followed by a hash value. It is calculated based on all business parameters of the current request.

Note

Repeated calls with the same parameters hit the same query result. Therefore, you must carry the exact same request parameters as the initial call when polling. Any parameter change generates a different ResultId and triggers a new query.

async__507044db6c4eadfa2dab9b084e80****

State

string

The current state of the asynchronous query. Valid values:

  • RUNNING: The query is running. Continue polling.

  • SUCCESS: The query is successful. The Data field has a value.

  • FAIL: The query failed.

Note

When the query fails, the operation directly returns an error code and an error message, instead of a normal response body with State set to FAIL.

SUCCESS

Timestamp

integer

The time when the asynchronous query was submitted, which is a UNIX timestamp in milliseconds.

Note

When the query fails, this value is the time when the failure occurred.

1718600000000

Message

string

The response message. An error description is returned when the request fails.

Successful

RequestId

string

The unique identifier of the request, which can be used for troubleshooting.

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

Success

string

Indicates whether the request was successful. Valid values:

  • true: The request was successful.

  • false: The request failed. Check the cause based on Code and Message.

true

Examples

Success response

JSON format

{
  "Code": "200",
  "Data": {
    "Data": {
      "Extra": "{}",
      "List": [
        {
          "AffectRows": 30,
          "AggKey": "651b56fe9418d48edb8fdf0980ec****",
          "AvgAffectRows": 30.2,
          "AvgCpuTime": 12.5,
          "AvgFrows": 10,
          "AvgLockWaitTime": 0.00009589874265269765,
          "AvgLogicalRead": 654.4470327860251,
          "AvgPhysicalAsyncRead": 0,
          "AvgPhysicalRead": 654.4,
          "AvgPhysicalSyncRead": 0,
          "AvgRows": 10,
          "AvgRowsExamined": 53421,
          "AvgRowsReturned": 14,
          "AvgRowsUpdated": 30.2,
          "AvgRt": 2.499,
          "AvgScanRows": 53421,
          "AvgScnt": 10,
          "AvgWrites": 10,
          "Count": 127,
          "CountRate": 0.0586,
          "CpuTime": 100,
          "Database": "dbtest01",
          "ErrorCode": "1146",
          "ErrorCount": 1,
          "FirstTime": 1659308149000,
          "Frows": 10,
          "Hash": "2e8147b5ca2dfc640dfd5e43d96a****",
          "Ip": "rm-2ze1jdv45i7l6****.mysql.rds.aliyuncs.com",
          "LockWaitTime": 1089.4177720290281,
          "LogicalRead": 165848,
          "MaxCpuTime": 30,
          "MaxLogicalRead": 3186,
          "MaxPhysicalRead": 3186,
          "MaxRowsExamined": 318613,
          "MaxRowsReturned": 20,
          "MaxRt": 12.499,
          "MaxWrites": 12,
          "MinCpuTime": 5,
          "MinLogicalRead": 12,
          "MinPhysicalRead": 12,
          "MinRowsReturned": 1,
          "MinRt": 0.409789,
          "MinWrites": 8,
          "OriginAlias": "order-1",
          "OriginHost": "172.26.XX.XXX",
          "Params": "[1, \"das\"]",
          "PhysicalAsyncRead": 0,
          "PhysicalRead": 165848,
          "PhysicalSyncRead": 0,
          "Port": 3306,
          "Psql": "select * from t_order where id = ?",
          "Rows": 10,
          "RowsExamined": 2048576,
          "RowsReturned": 14,
          "Rt": 0.409789,
          "RtGreaterThanOneSecondCount": 20,
          "RtRate": 0.1384,
          "SampleType": "sql",
          "ScanRows": 29,
          "Scnt": 10,
          "Sql": "select * from t_order where id = 1",
          "SqlId": "651b56fe9418d48edb8fdf0980ec****",
          "SqlNew": "select * from t_order where id = ?",
          "SqlTextFeature": "select_from_t_order",
          "SqlType": "select",
          "SumRowsUpdated": 3810,
          "Tables": [
            "t_order"
          ],
          "ThreadId": "57472578",
          "TimeRate": 0.1384,
          "Timestamp": 1718600000000,
          "TotalAffectRows": 3810,
          "TotalRt": 310,
          "TotalScanRows": 2048576,
          "Trend": [
            {
              "Timestamp": 1718000000000,
              "Value": "12"
            }
          ],
          "UpdateRows": 30,
          "User": "testUser",
          "Version": 1,
          "VpcId": "vpc-2zentqj1sk4qmolci****",
          "Writes": 10
        }
      ],
      "PageNo": 1,
      "PageSize": 10,
      "Total": 10
    },
    "ErrorCode": -10200020,
    "IsFinish": false,
    "Message": "startTime must be in 30 days and the interval must be within 7 day",
    "RequestKey": "507044db6c4eadfa2dab9b084e80****",
    "ResultId": "async__507044db6c4eadfa2dab9b084e80****",
    "State": "SUCCESS",
    "Timestamp": 1718600000000
  },
  "Message": "Successful",
  "RequestId": "B6D17591-B48B-4D31-9CD6-9B9796B2****",
  "Success": "true"
}

Error codes

HTTP status code

Error code

Error message

Description

400 InvalidParams The request parameters are invalid. The request parameters are invalid.
403 NoPermission You are not authorized to do this action. You do not have the permission to perform this operation.

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.