Queries the details of an SQL pattern within an AnalyticDB for MySQL cluster for a specified date.

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 DescribeSqlPattern

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

StartTime String Yes 2021-08-30

The date to query. Specify the time in the yyyy-MM-dd format. The time must be in UTC.

Note Only data for the last 30 days can be queried.
Order String No [{"Field":"Pattern","Type":"Asc"}]

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

  • Field indicates the field that is used to sort the retrieved entries. Valid values:
    • Pattern : the SQL pattern.
    • AccessIP: the IP address of the client.
    • User: the username.
    • QueryCount: the total number of queries.
    • AvgPeakMemory: the average peak memory. Unit: KB.
    • MaxPeakMemory: the maximum peak memory. Unit: KB.
    • AvgCpuTime: the average CPU time. Unit: milliseconds.
    • MaxCpuTime: the maximum CPU time. Unit: milliseconds.
    • AvgStageCount: the average number of stages.
    • MaxStageCount: the maximum number of stages.
    • AvgTaskCount: the average number of tasks.
    • MaxTaskCount: the maximum number of tasks.
    • AvgScanSize: the average scan size. Unit: KB.
    • MaxScanSize: the maximum scan size. Unit: KB.
  • Type indicates the sorting method. Valid values:
    • Asc: ascending order.
    • Desc: descending order.
Note
  • If this parameter is not specified, query results are sorted in ascending order of Pattern.
  • If you need to sort query results by AccessIP, you must set the Type parameter to accessip. If you need to sort query results by User, you must leave the Type parameter empty or set it to user.
PageNumber Integer No 1

The number of the page to return. The value must be an integer that is greater than 0. Default value: 1.

SqlPattern String No SELECT

The keyword contained in the SQL pattern.

Note If this parameter is not specified, all SQL patterns within an AnalyticDB for MySQL cluster for a date specified by StartTime are returned.
Type String No user

The dimension by which to aggregate the SQL pattern. Valid values:

  • user: the user.
  • accessip: the IP address of the client.
Note If this parameter is not specified, the SQL pattern is aggregated by user.
DBClusterId String Yes am-****************

The ID of the cluster.

Note You can call the DescribeDBClusters operation to query the details of all AnalyticDB for MySQL clusters within a specified region, including cluster IDs.
PageSize Integer No 30

The number of entries to return on each page. The value must be a positive integer. Default value: 30.

RegionId String Yes cn-hangzhou

The ID of the region.

Note You can call the DescribeRegions operation to query the regions and zones supported by AnalyticDB for MySQL, including region IDs.

Response parameters

Parameter Type Example Description
PageSize Integer 30

The number of entries returned on the current page.

PageNumber Integer 1

The page number of the returned page.

TotalCount Integer 1

The total number of entries.

Items Array of Items

Details about the SQL pattern.

AvgStageCount String 2

The average number of stages.

MaxCpuTime String 17

The maximum CPU time. Unit: milliseconds.

AccessIP String 100.104.***.***

The IP address of the client.

Note This parameter is returned only when the Type parameter is set to accessip.
AvgScanSize String 0

The average scan size. Unit: KB.

MaxScanSize String 0

The maximum scan size. Unit: KB.

MaxPeakMemory String 480096

The maximum peak memory. Unit: KB.

AvgCpuTime String 1.0625

The average CPU time. Unit: milliseconds.

User String test_acc

The username.

Note This parameter is returned only when the Type parameter is left empty or set to user.
AvgPeakMemory String 240048

The average peak memory. Unit: KB.

MaxStageCount String 2

The maximum number of stages.

MaxTaskCount String 2

The maximum number of tasks.

InstanceName String am-****************

The ID of the cluster.

QueryCount String 16

The total number of queries.

ReportDate String 2021-08-30

The query date.

Pattern String 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

The SQL pattern.

AvgTaskCount String 2

The average number of tasks.

RequestId String B6F2D1B4-2C9F-5622-B424-5E7965******

The ID of the request.

Examples

Sample requests

http(s)://adb.aliyuncs.com/?Action=DescribeSqlPattern
&StartTime=2021-08-30
&DBClusterId=am-****************
&RegionId=cn-hangzhou
&<Common request parameters>

Sample success responses

XML format

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

<DescribeSqlPatternResponse>
    <TotalCount>1</TotalCount>
    <PageSize>30</PageSize>
    <RequestId>B6F2D1B4-2C9F-5622-B424-5E7965******</RequestId>
    <PageNumber>1</PageNumber>
    <Items>
        <AvgPeakMemory>240048</AvgPeakMemory>
        <AccessIP/>
        <AvgCpuTime>1.0625</AvgCpuTime>
        <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</Pattern>
        <User>test_acc</User>
        <MaxStageCount>2</MaxStageCount>
        <AvgTaskCount>2</AvgTaskCount>
        <AvgScanSize>0</AvgScanSize>
        <ReportDate>2021-08-30</ReportDate>
        <AvgStageCount>2</AvgStageCount>
        <InstanceName>am-****************</InstanceName>
        <MaxScanSize>0</MaxScanSize>
        <MaxPeakMemory>480096</MaxPeakMemory>
        <MaxTaskCount>2</MaxTaskCount>
        <QueryCount>16</QueryCount>
        <MaxCpuTime>17</MaxCpuTime>
    </Items>
</DescribeSqlPatternResponse>

JSON format

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

{
  "TotalCount" : 1,
  "PageSize" : 30,
  "RequestId" : "B6F2D1B4-2C9F-5622-B424-5E7965******",
  "PageNumber" : 1,
  "Items" : [ {
    "AvgPeakMemory" : "240048",
    "AccessIP" : "",
    "AvgCpuTime" : "1.0625",
    "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",
    "User" : "test_acc",
    "MaxStageCount" : "2",
    "AvgTaskCount" : "2",
    "AvgScanSize" : "0",
    "ReportDate" : "2021-08-30",
    "AvgStageCount" : "2",
    "InstanceName" : "am-****************",
    "MaxScanSize" : "0",
    "MaxPeakMemory" : "480096",
    "MaxTaskCount" : "2",
    "QueryCount" : "16",
    "MaxCpuTime" : "17"
  } ]
}

Error codes

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