All Products
Search
Document Center

AnalyticDB:DescribeSQLPatterns

Last Updated:Aug 30, 2024

Queries a list of SQL patterns for an AnalyticDB for MySQL cluster within a period of time.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
adb:DescribeSQLPatternsget
  • DBCluster
    acs:adb:{#regionId}:{#accountId}:dbcluster/{#DBClusterId}
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
DBClusterIdstringYes

The cluster ID.

Note You can call the DescribeDBClusters operation to query the information about all AnalyticDB for MySQL clusters in a region, including cluster IDs.
am-bp1r053byu48p****
StartTimestringYes

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

Note
  • Only data within the last 14 days can be queried. For example, if the current time is 2021-11-22T12:00:00Z, you can query SQL patterns at a point in time as early as 2021-11-09T12:00:00Z.

  • The maximum time range that can be specified is 24 hours.

2021-09-30T00:10:00Z
EndTimestringYes

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

Note The end time must be later than the start time.
2021-09-30T00:15:00Z
RegionIdstringYes

The region ID of the cluster.

Note You can call the DescribeRegions operation to query the most recent region list.
cn-hangzhou
KeywordstringNo

The keyword that is used for the query.

SELECT
OrderstringYes

The order by which to sort query results. Specify the parameter value in the JSON format. Example: [{"Field":"AverageQueryTime","Type":"Asc"}].

  • Field specifies the field by which to sort the query results. Valid values:

    • PatternCreationTime: the earliest commit time of the SQL pattern within the time range to query.
    • AverageQueryTime: the average total amount of time consumed by the SQL pattern within the time range to query.
    • MaxQueryTime: the maximum total amount of time consumed by the SQL pattern within the time range to query.
    • AverageExecutionTime: the average execution duration of the SQL pattern within the time range to query.
    • MaxExecutionTime: the maximum execution duration of the SQL pattern within the time range to query.
    • AveragePeakMemory: the average peak memory usage of the SQL pattern within the time range to query.
    • MaxPeakMemory: the maximum peak memory usage of the SQL pattern within the time range to query.
    • AverageScanSize: the average amount of data scanned based on the SQL pattern within the time range to query.
    • MaxScanSize: the maximum amount of data scanned based on the SQL pattern within the time range to query.
    • QueryCount: the number of queries performed in association with the SQL pattern within the time range to query.
    • FailedCount: the number of failed queries performed in association with the SQL pattern within the time range to query.
  • Type specifies the sorting order. Valid values (case-insensitive):

    • Asc: ascending order.
    • Desc: descending order.
[{"Field":"AverageQueryTime","Type":"Asc"}]
PageNumberintegerNo

The page number. Pages start from page 1.

Note If you do not specify this parameter, the value 1 is used.
1
PageSizeintegerNo

The number of entries per page. Valid values:

  • 30
  • 50
  • 100
Note If you do not specify this parameter, the value 30 is used.
30
LangstringNo

The language of file titles and error messages. Valid values:

  • zh (default): simplified Chinese.
  • en: English.
  • ja: Japanese.
  • zh-tw: traditional Chinese.
zh

Response parameters

ParameterTypeDescriptionExample
object

The response parameters.

PageNumberinteger

The page number.

1
PageSizeinteger

The number of entries per page.

30
TotalCountinteger

The total number of entries returned.

1
PatternDetailsarray<object>

The queried SQL patterns.

object

The queried SQL pattern.

SQLPatternstring

The statement of the SQL pattern.

SELECT * FROM KEPLER_META_NODE_STATIC_INFO WHERE elastic_node = ? OR (elastic_node = ? AND enable = ?)
PatternIdstring

The ID of the SQL pattern.

5575924945138******
Userstring

The database username that is used to commit the SQL pattern.

reporter
AccessIpstring

The IP address of the SQL client that commits the SQL pattern.

192.168.xx.xx
Tablesstring

The tables scanned based on the SQL pattern.

tpch.orders
PatternCreationTimestring

The earliest commit time of the SQL pattern within the query time range. Unit: milliseconds.

2021-11-12 03:06:00
AverageQueryTimedouble

The average total amount of time consumed by the SQL pattern within the query time range. Unit: milliseconds.

4
MaxQueryTimelong

The maximum total amount of time consumed by the SQL pattern within the query time range. Unit: milliseconds.

2341
AverageExecutionTimedouble

The average execution duration of the SQL pattern within the query time range. Unit: milliseconds.

234.78
MaxExecutionTimelong

The maximum execution duration of the SQL pattern within the query time range. Unit: milliseconds.

2142
AveragePeakMemorydouble

The average peak memory usage of the SQL pattern within the query time range. Unit: bytes.

234.22
MaxPeakMemorylong

The maximum peak memory usage of the SQL pattern within the query time range. Unit: bytes.

234149
AverageScanSizedouble

The average amount of data scanned based on the SQL pattern within the query time range. Unit: bytes.

234149.23
MaxScanSizelong

The maximum amount of data scanned based on the SQL pattern within the query time range. Unit: bytes.

234149
QueryCountlong

The number of queries executed in association with the SQL pattern within the query time range.

345
FailedCountlong

The number of failed queries executed in association with the SQL pattern within the query time range.

234
Blockableboolean

Indicates whether the execution of the SQL pattern can be blocked. Valid values:

  • true
  • false
Note Only SELECT and INSERT statements can be blocked.
true
RequestIdstring

The request ID.

6BE0EDD1-0DE6-3EB6-81BF-BFE4F2******

Examples

Sample success responses

JSONformat

{
  "PageNumber": 1,
  "PageSize": 30,
  "TotalCount": 1,
  "PatternDetails": [
    {
      "SQLPattern": "SELECT * FROM KEPLER_META_NODE_STATIC_INFO WHERE elastic_node = ? OR (elastic_node = ? AND enable = ?)",
      "PatternId": "5575924945138******",
      "User": "reporter",
      "AccessIp": "192.168.xx.xx",
      "Tables": "tpch.orders",
      "PatternCreationTime": "2021-11-12 03:06:00",
      "AverageQueryTime": 4,
      "MaxQueryTime": 2341,
      "AverageExecutionTime": 234.78,
      "MaxExecutionTime": 2142,
      "AveragePeakMemory": 234.22,
      "MaxPeakMemory": 234149,
      "AverageScanSize": 234149.23,
      "MaxScanSize": 234149,
      "QueryCount": 345,
      "FailedCount": 234,
      "Blockable": true
    }
  ],
  "RequestId": "6BE0EDD1-0DE6-3EB6-81BF-BFE4F2******"
}

Error codes

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2021-10-12The response structure of the API has changedView Change Details