DescribeSQLPatterns

更新时间:
复制 MD 格式

View the list of SQL patterns for an AnalyticDB for MySQL Data Lakehouse Edition cluster for a specified date range.

Operation description

  • Global public endpoint: adb.aliyuncs.com.

  • Regional public endpoint: adb.<region-id>.aliyuncs.com (e.g., adb.cn-hangzhou.aliyuncs.com).

  • Regional VPC endpoint: adb-vpc.<region-id>.aliyuncs.com (e.g., adb-vpc.cn-hangzhou.aliyuncs.com).

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

adb:DescribeSQLPatterns

list

*All Resource

*

None None

Request parameters

Parameter

Type

Required

Description

Example

DBClusterId

string

Yes

The ID of the AnalyticDB for MySQL (Data Lakehouse Edition) cluster.

Note

You can call the DescribeDBClusters API to find the cluster IDs of all AnalyticDB for MySQL (Data Lakehouse Edition) clusters in a specific region.

amv-8vb8de93v9b****

StartTime

string

No

The start of the time range to query. The time must be in UTC and formatted as yyyy-MM-ddTHH:mm:ssZ.

Note
  • Data is available for the last 14 days only.

  • The time range cannot exceed 24 hours.

2022-09-06T03:06:00Z

EndTime

string

No

The end of the time range to query. The time must be in UTC and formatted as yyyy-MM-ddTHH:mm:ssZ.

Note

The end time must be later than the start time.

2022-09-07T03:06:00Z

RegionId

string

Yes

The ID of the region.

cn-hangzhou

Keyword

string

No

The keyword for filtering the query results.

SELECT

Order

string

No

The sort order for the results. Specify this parameter as a JSON string, for example, [{"Field":"AverageQueryTime","Type":"Asc"}]. The string consists of the following fields:

  • Field: the sort field. Valid values:

    • PatternCreationTime: The earliest submission time of the pattern.

    • AverageQueryTime: The average query time of the pattern.

    • MaxQueryTime: The maximum query time of the pattern.

    • AverageExecutionTime: The average execution time of the pattern.

    • MaxExecutionTime: The maximum execution time of the pattern.

    • AveragePeakMemory: The average peak memory of the pattern.

    • MaxPeakMemory: The maximum peak memory of the pattern.

    • AverageScanSize: The average scanned data size of the pattern.

    • MaxScanSize: The maximum scanned data size of the pattern.

    • QueryCount: The query count of the pattern.

    • FailedCount: The failure count of the pattern.

  • Type: the sort order. Valid values (case-insensitive):

    • Asc: ascending order.

    • Desc: descending order.

[{"Field":"AverageQueryTime","Type":"Asc"}]

PageNumber

integer

No

The page number. Must be an integer greater than 0. Default: 1.

2

PageSize

integer

No

The number of entries per page. Valid values:

  • 10 (default)

  • 30

  • 50

  • 100

10

Lang

string

No

The response language. Valid values:

  • zh: Simplified Chinese (default)

  • en: English

  • ja: Japanese

  • zh-tw: Traditional Chinese

zh

UserName

string

No

The username of the database account used to execute the SQL statements.

test_user

Response elements

Element

Type

Description

Example

object

The details of the SQL patterns.

PageNumber

integer

The page number.

2

PageSize

integer

The number of entries per page.

10

TotalCount

integer

The total number of entries.

20

PatternDetails

array<object>

A list of SQL patterns.

object

The details of the SQL pattern.

SQLPattern

string

The SQL pattern.

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

PatternId

string

The ID of the SQL pattern.

5575924945138******

User

string

The name of the database user who submitted the matching SQL statements.

test

AccessIp

string

The client IP address used to submit the queries.

192.168.xx.xx

Tables

string

The tables scanned by the SQL pattern.

tpch.orders

PatternCreationTime

string

The submission time of the first query that matches this pattern within the specified time range.

2022-09-06 05:06:00

AverageQueryTime

number

The average duration of queries matching this pattern. Unit: milliseconds.

4

MaxQueryTime

integer

The maximum duration of a query matching this pattern. Unit: milliseconds.

2341

AverageExecutionTime

number

The average execution time of queries matching this pattern. Unit: milliseconds.

234.78

MaxExecutionTime

integer

The maximum execution time of a query matching this pattern. Unit: milliseconds.

2142

AveragePeakMemory

number

The average peak memory usage of queries matching this pattern. Unit: bytes.

234.22

MaxPeakMemory

integer

The maximum peak memory usage of a query matching this pattern. Unit: bytes.

234149

AverageScanSize

number

The average amount of data scanned by queries matching this pattern. Unit: bytes.

234149.23

MaxScanSize

integer

The maximum amount of data scanned by a query matching this pattern. Unit: bytes.

32212254

QueryCount

integer

The number of executed queries that match this pattern.

345

FailedCount

integer

The number of failed queries that match this pattern.

18

Blockable

boolean

Indicates whether queries that match this pattern can be blocked. Valid values:

  • true: The queries can be blocked.

  • false: The queries cannot be blocked.

Note

Currently, AnalyticDB for MySQL allows you to block only SELECT and INSERT statements.

true

QueryTimeSum

number

The total query duration for all queries that match this pattern. Unit: milliseconds.

5

QueryTimePercentage

number

The total query time of queries matching this pattern as a percentage of the total query time for all queries. Unit: %.

10

PeakMemorySum

number

The sum of the peak memory usage for all queries that match this pattern. Unit: bytes.

5

PeakMemoryPercentage

number

The total peak memory usage of queries matching this pattern as a percentage of the total peak memory usage for all queries. Unit: %.

10

ScanSizeSum

number

The total amount of data scanned by all queries that match this pattern. Unit: bytes.

5

ScanSizePercentage

number

The total amount of data scanned by queries matching this pattern as a percentage of the total data scanned by all queries. Unit: %.

80

AverageOperatorCost

number

The average CPU cost for queries that match this pattern. Unit: milliseconds.

5

MaxOperatorCost

number

The maximum CPU cost for a query that matches this pattern. Unit: milliseconds.

5

OperatorCostSum

number

The total CPU cost for all queries that match this pattern. Unit: milliseconds.

5

OperatorCostPercentage

number

The total CPU cost of queries matching this pattern as a percentage of the total CPU cost for all queries. Unit: %.

20

AverageScanCost

number

The average scan time for queries that match this pattern. Unit: milliseconds.

5

MaxScanCost

number

The maximum scan time for a query that matches this pattern. Unit: milliseconds.

5

ScanCostSum

number

The total scan cost for all queries that match this pattern. Unit: milliseconds.

5

ScanCostPercentage

number

The total scan cost of queries matching this pattern as a percentage of the total scan cost for all queries. Unit: %.

5

RequestId

string

The request ID.

F3174013-5B7A-5A47-9FE0-6B5D397BD86A

AccessDeniedDetail

string

Details about the access denial. This parameter is returned only if RAM authentication fails.

{ "PolicyType": "AccountLevelIdentityBasedPolicy", "AuthPrincipalOwnerId": "1*****************7", "EncodedDiagnosticMessage": "AQIBIAAAAOPdwKY2QLOvgMEc7SkkoJfj1kvZwsaRqNYMh10Tv0wTe0fCzaCdrvgazfNb0EnJKETgXyhR+3BIQjx9WAqZryejBsp1Bl4qI5En/D9dEhcXAtKCxCmE2kZCiEzpy8BoEUt+bs0DmlaGWO5xkEpttypLIB4rUhDvZd+zwPg4EXk4KSSWSWsurxtqDkKEMshKlQFBTKvJcKwyhk62IeYly4hQ+5IpXjkh1GQXuDRCQ==", "AuthPrincipalType": "SubUser", "AuthPrincipalDisplayName": "2***************9", "NoPermissionType": "ImplicitDeny", "AuthAction": "adb:DescribeExcessivePrimaryKeys" }

Examples

Success response

JSON format

{
  "PageNumber": 2,
  "PageSize": 10,
  "TotalCount": 20,
  "PatternDetails": [
    {
      "SQLPattern": "SELECT * FROM KEPLER_META_NODE_STATIC_INFO WHERE elastic_node = ? OR (elastic_node = ? AND enable = ?)",
      "PatternId": "5575924945138******",
      "User": "test",
      "AccessIp": "192.168.xx.xx",
      "Tables": "tpch.orders",
      "PatternCreationTime": "2022-09-06 05:06:00",
      "AverageQueryTime": 4,
      "MaxQueryTime": 2341,
      "AverageExecutionTime": 234.78,
      "MaxExecutionTime": 2142,
      "AveragePeakMemory": 234.22,
      "MaxPeakMemory": 234149,
      "AverageScanSize": 234149.23,
      "MaxScanSize": 32212254,
      "QueryCount": 345,
      "FailedCount": 18,
      "Blockable": true,
      "QueryTimeSum": 5,
      "QueryTimePercentage": 10,
      "PeakMemorySum": 5,
      "PeakMemoryPercentage": 10,
      "ScanSizeSum": 5,
      "ScanSizePercentage": 80,
      "AverageOperatorCost": 5,
      "MaxOperatorCost": 5,
      "OperatorCostSum": 5,
      "OperatorCostPercentage": 20,
      "AverageScanCost": 5,
      "MaxScanCost": 5,
      "ScanCostSum": 5,
      "ScanCostPercentage": 5
    }
  ],
  "RequestId": "F3174013-5B7A-5A47-9FE0-6B5D397BD86A",
  "AccessDeniedDetail": "{\n    \"PolicyType\": \"AccountLevelIdentityBasedPolicy\",\n    \"AuthPrincipalOwnerId\": \"1*****************7\",\n    \"EncodedDiagnosticMessage\": \"AQIBIAAAAOPdwKY2QLOvgMEc7SkkoJfj1kvZwsaRqNYMh10Tv0wTe0fCzaCdrvgazfNb0EnJKETgXyhR+3BIQjx9WAqZryejBsp1Bl4qI5En/D9dEhcXAtKCxCmE2kZCiEzpy8BoEUt+bs0DmlaGWO5xkEpttypLIB4rUhDvZd+zwPg4EXk4KSSWSWsurxtqDkKEMshKlQFBTKvJcKwyhk62IeYly4hQ+5IpXjkh1GQXuDRCQ==\",\n    \"AuthPrincipalType\": \"SubUser\",\n    \"AuthPrincipalDisplayName\": \"2***************9\",\n    \"NoPermissionType\": \"ImplicitDeny\",\n    \"AuthAction\": \"adb:DescribeExcessivePrimaryKeys\"\n}"
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.