Queries the patterns of a specific SQL statement.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes DescribeDBInstanceSQLPatterns

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

DBInstanceId String Yes gp-xxxxxxxx

The ID of the instance.

Note You can call the DescribeDBInstances operation to query details of all AnalyticDB for PostgreSQL instances in a specific region, including instance IDs.
QueryKeywords String Yes sql_pattern

The keyword for the query. Set the value to sql_pattern.

StartTime String Yes 2021-08-03T09:25Z

The beginning of the time range to query. Specify the time in the ISO 8601 standard in the yyyy-MM-ddTHH:mmZ format. The time must be in UTC.

Database String No test_db

The name of the database.

User String No test_user

The database user.

EndTime String Yes 2021-08-04T09:25Z

The end of the time range to query. Specify the time in the ISO 8601 standard in the yyyy-MM-ddTHH:mmZ format. The time must be in UTC.

Note The end time must be later than the start time. Their interval cannot be more than seven days.
SourceIP String No 10.**.**.10

The source IP address.

Response parameters

Parameter Type Example Description
EndTime String 2021-08-03T09:31Z

The end time of the query.

Note This parameter is returned only when the QueryKeywords parameter is not set to sql_pattern.
RequestId String 4BBA1119-65FD-50B4-8A1D-B4**********

The ID of the request.

StartTime String 2021-08-03T09:30Z

The start time of the query.

Note This parameter is returned only when the QueryKeywords parameter is not set to sql_pattern.
DBClusterId String gp-xxxxxxxx

The ID of the instance.

Note This parameter is returned only when the QueryKeywords parameter is not set to sql_pattern.
Patterns Array of Pattern

The patterns.

Name String Database_Ratio

The name of the pattern. Valid values:

  • Database_Ratio
  • SQL_Type_Ratio
  • SQL_Cost_Ratio
  • SQL_Success_Ratio
  • User_SQL_Ratio
Values Map

The value of the pattern.

Examples

Sample requests

http(s)://gpdb.aliyuncs.com/?Action=DescribeDBInstanceSQLPatterns
&DBInstanceId=gp-xxxxxxxx
&QueryKeywords=sql_pattern
&StartTime=2021-08-03T09:25Z
&EndTime=2021-08-04T09:25Z
&<Common request parameters>

Sample success responses

XML format

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

<DescribeDBInstanceSQLPatternsResponse>
    <RequestId>4BBA1119-65FD-50B4-8A1D-B4**********</RequestId>
    <Patterns>
        <Values>
            <postgres>2</postgres>
        </Values>
        <Name>Database_Ratio</Name>
    </Patterns>
    <Patterns>
        <Values>
            <other>1</other>
            <select>1</select>
        </Values>
        <Name>SQL_Type_Ratio</Name>
    </Patterns>
    <Patterns>
        <Values>
            <test_user>2</test_user>
        </Values>
        <Name>User_SQL_Ratio</Name>
    </Patterns>
    <Patterns>
        <Values>
            <0~100ms>2</0~100ms>
        </Values>
        <Name>SQL_Cost_Ratio</Name>
    </Patterns>
</DescribeDBInstanceSQLPatternsResponse>

JSON format

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

{
  "RequestId" : "4BBA1119-65FD-50B4-8A1D-B4**********",
  "Patterns" : [ {
    "Values" : {
      "postgres" : 2
    },
    "Name" : "Database_Ratio"
  }, {
    "Values" : {
      "other" : 1,
      "select" : 1
    },
    "Name" : "SQL_Type_Ratio"
  }, {
    "Values" : {
      "test_user" : 2
    },
    "Name" : "User_SQL_Ratio"
  }, {
    "Values" : {
      "0~100ms" : 2
    },
    "Name" : "SQL_Cost_Ratio"
  } ]
}

Error codes

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