Queries a list of SQL patterns for an AnalyticDB for MySQL cluster within a time range.
Debugging
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.
Operation | Access level | Resource type | Condition key | Associated operation |
---|---|---|---|---|
adb:DescribeSqlPattern | get |
|
| none |
Request parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
StartTime | string | Yes | The start date to query. Specify the time in the yyyy-MM-dd format. The time must be in UTC. Note
Only data within the last 30 days can be queried.
| 2021-08-30 |
Order | string | No | The order by which to sort query results. Specify the parameter value in the JSON string format. Example:
Note
| [{"Field":"Pattern","Type":"Asc"}] |
PageNumber | integer | No | The page number. Pages start from page 1. Default value: 1. | 1 |
SqlPattern | string | No | The keyword that is used for the query. Note
If you do not specify this parameter, all SQL patterns of the AnalyticDB for MySQL cluster within the time period specified by StartTime are returned.
| SELECT |
Type | string | No | The dimension by which to aggregate the SQL patterns. Valid values:
Note
If you do not specify this parameter, the SQL patterns are aggregated by user .
| user |
DBClusterId | string | Yes | The cluster ID. Note
You can call the DescribeDBClusters operation to query the information about all AnalyticDB for MySQL clusters within a region, including cluster IDs.
| am-bp1r053byu48p**** |
PageSize | integer | No | The number of entries per page. The value must be a positive integer. Default value: 30. | 30 |
RegionId | string | Yes | The region ID of the cluster. Note
You can call the DescribeRegions operation to query the most recent region list.
| cn-hangzhou |
Response parameters
Examples
Sample success responses
JSON
format
{
"PageSize": 30,
"PageNumber": 1,
"TotalCount": 1,
"Items": [
{
"AvgStageCount": "2",
"MaxCpuTime": "17",
"AccessIP": "100.104.***.***",
"AvgScanSize": "0",
"MaxScanSize": "0",
"MaxPeakMemory": "480096",
"AvgCpuTime": "1.0625",
"User": "test_acc",
"AvgPeakMemory": "240048",
"MaxStageCount": "2",
"MaxTaskCount": "2",
"InstanceName": "am-bp1r053byu48p****",
"QueryCount": "16",
"ReportDate": "2021-08-30",
"Pattern": "SELECT table_name, table_schema AS schema_name, create_time, create_time AS last_ddl_time, table_comment AS description , ceil((data_length + index_length) / ? / ?) AS store_capacity , data_length AS data_bytes, index_length AS index_bytes, table_collation AS collation, auto_increment, table_rows AS num_rows , engine FROM information_schema.tables WHERE table_type != ? AND table_schema = ? AND table_name IN (?) ORDER BY 1",
"AvgTaskCount": "2"
}
],
"RequestId": "B6F2D1B4-2C9F-5622-B424-5E7965******"
}
Error codes
For a list of error codes, visit the Service error codes.