Queries information about the best-performing and worst-performing instances based on query governance data.

  • 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 API operations of DAS, you must set the region ID to cn-shanghai.
  • This operation is applicable to the following database services:
    • ApsaraDB RDS for MySQL
    • PolarDB for MySQL
    • ApsaraDB RDS for PostgreSQL

Request parameters

ParameterTypeRequiredExampleDescription
ActionStringYesGetQueryOptimizeDataTop

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

EngineStringYesMySQL

The database engine. Valid values:

  • MySQL
  • PolarDBMySQL
  • PostgreSQL
InstanceIdsStringNorm-2ze8g2am97624****

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

TagNamesStringNoNone

A reserved parameter.

TimeStringYes1642953600000

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

TypeStringYesRED

The type of instances that you want to query. Valid values:

  • RED: the best-performing instances
  • BLACK: the worst-performing instances
RegionStringNocn-china

The region in which the instance resides. Valid values:

  • cn-china: Chinese mainland
  • cn-hongkong: China (Hong Kong)
  • ap-southeast-1: Singapore

This parameter is valid only if the InstanceIds parameter is left empty. If you do not specify the InstanceIds parameter, the system obtains data from the region set by the Region parameter. By default, the Region parameter is set to cn-china. If you have specified the InstanceIds parameter, the specified Region parameter becomes invalid and the system obtains data from the region in which the first specified instance resides.

Note If your instances reside in the regions inside the Chinese mainland, set this parameter to cn-china.

Response parameters

ParameterTypeExampleDescription
CodeString200

The HTTP status code returned.

MessageStringSuccessful

The message that is returned for the request.

DataObject

The details about the instances.

TotalLong10

The total number of entries returned.

PageNoIntegerNone

A reserved parameter.

PageSizeIntegerNone

A reserved parameter.

ExtraStringNone

A reserved parameter.

ListArray of QueryOptimizeDataTops

The information about the instances.

InstanceIdStringrm-2ze8g2am97624****

The ID of the instance.

TypeStringsqlExecuteCount

The metric name. Valid values:

  • sqlExecuteCount: the number of slow SQL executions.
  • optimizedSqlExecuteCount: the number of slow SQL executions that need to be optimized.
Valuedouble100

The metric value.

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

The ID of the request.

SuccessStringtrue

Indicates whether the request was successful. Valid values:

  • true: The request was successful.
  • false: The request failed.

Examples

Sample requests

http(s)://das.cn-shanghai.aliyuncs.com/?Action=GetQueryOptimizeDataTop
&Engine=MySQL
&InstanceIds=rm-2ze8g2am97624****
&TagNames=None
&Time=1642953600000
&Type=RED
&Region=cn-china
&Common request parameters

Sample success responses

XML format

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

<GetQueryOptimizeDataTopResponse>
    <Code>200</Code>
    <Message>Successful</Message>
    <Data>
        <Total>10</Total>
        <Extra>None</Extra>
        <List>
            <InstanceId>rm-2ze8g2am97624****</InstanceId>
            <Type>sqlExecuteCount</Type>
            <Value>100</Value>
        </List>
    </Data>
    <RequestId>B6D17591-B48B-4D31-9CD6-9B9796B2****</RequestId>
    <Success>true</Success>
</GetQueryOptimizeDataTopResponse>

JSON format

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

{
  "Code" : "200",
  "Message" : "Successful",
  "Data" : {
    "Total" : 10,
    "Extra" : "None",
    "List" : [ {
      "InstanceId" : "rm-2ze8g2am97624****",
      "Type" : "sqlExecuteCount",
      "Value" : 100
    } ]
  },
  "RequestId" : "B6D17591-B48B-4D31-9CD6-9B9796B2****",
  "Success" : "true"
}

Error codes

HTTP status codeError codeError messageDescription
400InvalidParamsThe request parameters are invalid.The error message returned because the specified request parameters are invalid.

For a list of error codes, see Service error codes.