You can call the DescribeSQLPatterns operation to view a list of SQL patterns for an AnalyticDB for MySQL cluster on a specified date.
Operation description
Public endpoint:
adb.aliyuncs.com.Public endpoint for a region:
adb.<region-id>.aliyuncs.com. Example:adb.cn-hangzhou.aliyuncs.com.VPC endpoint for a region:
adb-vpc.<region-id>.aliyuncs.com. Example:adb-vpc.cn-hangzhou.aliyuncs.com.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
adb:DescribeSQLPatterns |
list |
DBCluster
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| DBClusterId |
string |
Yes |
The cluster ID. Note
Call the DescribeDBClusters operation to query the details of all AnalyticDB for MySQL clusters in a specific region, including cluster IDs. |
am-bp1r053byu48p**** |
| StartTime |
string |
Yes |
The start of the time range to query. Specify the time in the yyyy-MM-ddTHH:mm:ssZ format. The time must be in UTC. Note
|
2021-09-30T00:10:00Z |
| EndTime |
string |
Yes |
The end of the time range to query. Specify the time 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 |
| RegionId |
string |
Yes |
The region ID. Note
Call the DescribeRegions operation to query the regions and zones where AnalyticDB for MySQL is available, including region IDs. |
cn-hangzhou |
| Keyword |
string |
No |
The SQL keyword. |
SELECT |
| Order |
string |
Yes |
The sorting order of the query results. Specify the value as a JSON string. Example:
|
[{"Field":"AverageQueryTime","Type":"Asc"}] |
| PageNumber |
integer |
No |
The page number. The value must be an integer that is greater than 0 and does not exceed the maximum value of the integer data type. Note
The default value is 1. |
1 |
| PageSize |
integer |
No |
The number of entries per page. Valid values:
Note
The default value is 30. |
30 |
| Lang |
string |
No |
The language of the file title and some error messages in the downloaded file. Valid values:
|
zh |
| UserName |
string |
No |
The username. |
test_user |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
The list of information. |
||
| PageNumber |
integer |
The page number. |
1 |
| PageSize |
integer |
The number of entries on the current page. |
30 |
| TotalCount |
integer |
The total number of entries. |
1 |
| PatternDetails |
array<object> |
The details of the SQL patterns. |
|
|
object |
The list of SQL patterns. |
||
| SQLPattern |
string |
The statement of 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 username of the database account that submitted the SQL statements associated with the pattern. |
reporter |
| AccessIp |
string |
The IP address of the client that submitted the SQL statements associated with the pattern. |
192.168.xx.xx |
| Tables |
string |
The name of the database table scanned by the SQL pattern. |
tpch.orders |
| PatternCreationTime |
string |
The earliest submission time of the SQL pattern in the time range. Unit: milliseconds. |
2021-11-12 03:06:00 |
| AverageQueryTime |
number |
The average total time of the SQL pattern in the time range. Unit: milliseconds. |
4 |
| MaxQueryTime |
integer |
The maximum total time of the SQL pattern in the time range. Unit: milliseconds. |
2341 |
| AverageExecutionTime |
number |
The average execution duration of the SQL pattern in the time range. Unit: milliseconds. |
234.78 |
| MaxExecutionTime |
integer |
The maximum execution duration of the SQL pattern in the time range. Unit: milliseconds. |
2142 |
| AveragePeakMemory |
number |
The average peak memory usage of the SQL pattern in the time range. Unit: bytes. |
234.22 |
| MaxPeakMemory |
integer |
The maximum peak memory usage of the SQL pattern in the time range. Unit: bytes. |
234149 |
| AverageScanSize |
number |
The average amount of data scanned by the SQL pattern in the time range. Unit: bytes. |
234149.23 |
| MaxScanSize |
integer |
The maximum amount of data scanned by the SQL pattern in the time range. Unit: bytes. |
234149 |
| QueryCount |
integer |
The number of executions of the SQL pattern in the time range. |
345 |
| FailedCount |
integer |
The number of failed executions of the SQL pattern in the time range. |
234 |
| Blockable |
boolean |
Indicates whether the execution of the SQL pattern can be blocked. Valid values:
Note
Currently, AnalyticDB for MySQL supports blocking only Select and Insert statements. |
true |
| QueryTimeSum |
number |
The total time. Unit: milliseconds. |
5 |
| QueryTimePercentage |
number |
The proportion of the total time of a single SQL pattern to the total time of all SQL patterns in the time range. Unit: %. |
10 |
| PeakMemorySum |
number |
The total peak memory usage. Unit: bytes. |
5 |
| PeakMemoryPercentage |
number |
The proportion of the total peak memory usage. Unit: %. |
10 |
| ScanSizeSum |
number |
The total amount of scanned data. Unit: bytes. |
5 |
| ScanSizePercentage |
number |
The proportion of the total amount of scanned data. Unit: %. |
80 |
| AverageOperatorCost |
number |
The average CPU cost. Unit: milliseconds. |
5 |
| MaxOperatorCost |
number |
The maximum CPU cost. Unit: milliseconds. |
5 |
| OperatorCostSum |
number |
The total CPU cost. Unit: milliseconds. |
5 |
| OperatorCostPercentage |
number |
The proportion of the total CPU cost. Unit: %. |
20 |
| AverageScanCost |
number |
The average CPU cost for table scans. Unit: milliseconds. |
5 |
| MaxScanCost |
number |
The maximum CPU cost for table scans. Unit: milliseconds. |
5 |
| ScanCostSum |
number |
The total amount of data scanned, in bytes. |
5 |
| ScanCostPercentage |
number |
The proportion of the total cost of data scans. Unit: %. |
5 |
| RequestId |
string |
The request ID. |
6BE0EDD1-0DE6-3EB6-81BF-BFE4F2****** |
Examples
Success response
JSON format
{
"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,
"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": "6BE0EDD1-0DE6-3EB6-81BF-BFE4F2******"
}
Error codes
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.