Obtains query governance trend data.

Usage notes

  • If you use an Alibaba Cloud SDK, make sure that the aliyun-sdk-core version is later than V2.1.8. We recommend that you use the latest version.
  • The version of your Database Autonomy Service (DAS) SDK must be V2.1.8 or later.
  • If you use an SDK to call DAS, you must set the region to cn-shanghai.
  • This operation supports the following database services:
    • ApsaraDB RDS for MySQL
    • PolarDB for MySQL
    • ApsaraDB RDS for PostgreSQL

Request parameters

Parameter Type Required Example Description
Action String Yes GetQueryOptimizeDataTrend

The operation that you want to perform. Set the value to GetQueryOptimizeDataTrend.

Engine String Yes MySQL

The database engine. Valid values:

  • MySQL
  • PolarDBMySQL
  • PostgreSQL
InstanceIds String No rm-2ze8g2am97624****

The instance IDs. Separate multiple IDs with commas (,).

TagNames String No None

A reserved parameter.

Start String Yes 1642435200000

The beginning of the time range to query. Specify the time in the UNIX timestamp format. Unit: milliseconds.

Note You can specify a start time up to two months earlier than the current time.
End String Yes 1643040000000

The end of the time range to query. Specify the time in the UNIX timestamp format. Unit: milliseconds.

Note The end time must be later than the start time, but no later than 00:00:00 (UTC+8) on the current day.

Response parameters

Parameter Type Example Description
Code String 200

The returned HTTP status code.

Message String Successful

The message that is returned for the request.

Data Object

Details of the returned entries.

Total Long 10

The total number of entries returned.

PageNo Integer None

A reserved parameter.

PageSize Integer None

A reserved parameter.

Extra String None

A reserved parameter.

List Array of QueryOptimizeDataTrends

Details of the trend data.

Kpi String sqlExecuteCount

The name of the metric. Valid values:

  • sqlExecuteCount: the number of slow SQL executions.
  • sqlExecuteCountDiff: the difference in the number of slow SQL executions compared to the previous day.
  • sqlCount: the number of slow SQL templates.
  • sqlCountDiff: the difference in the number of slow SQL templates compared to the previous day.
  • optimizedSqlExecuteCount: the number of optimizable SQL executions.
  • optimizedSqlExecuteCountDiff: the difference in the number of optimizable SQL executions compared to the previous day.
  • optimizedSqlCount: the number of optimizable SQL templates.
  • optimizedSqlCountDiff: the difference in the number of optimizable SQL templates compared to the previous day.
Timestamp Long 1643040000000

The queried date. The value of this parameter is a UNIX timestamp. Unit: milliseconds.

Value Double 1000

The value of the metric.

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

The ID of the request.

Success String true

Indicates whether the request is successful. Valid values:

  • true
  • false

Examples

Sample requests

http(s)://das.cn-shanghai.aliyuncs.com/?Action=GetQueryOptimizeDataTrend
&Engine=MySQL
&InstanceIds=rm-2ze8g2am97624****
&TagNames=None
&Start=1642435200000
&End=1643040000000
&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<GetQueryOptimizeDataTrendResponse>
    <Code>200</Code>
    <Message>Successful</Message>
    <Data>
        <Total>10</Total>
        <Extra>None</Extra>
        <List>
            <Kpi>sqlExecuteCount</Kpi>
            <Timestamp>1643040000000</Timestamp>
            <Value>1000</Value>
        </List>
    </Data>
    <RequestId>B6D17591-B48B-4D31-9CD6-9B9796B2****</RequestId>
    <Success>true</Success>
</GetQueryOptimizeDataTrendResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "Code" : "200",
  "Message" : "Successful",
  "Data" : {
    "Total" : 10,
    "Extra" : "None",
    "List" : [ {
      "Kpi" : "sqlExecuteCount",
      "Timestamp" : 1643040000000,
      "Value" : 1000
    } ]
  },
  "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 error message returned because the specified request parameters are invalid.

For a list of error codes, visit the API Error Center.