调用DescribeSqlPattern接口查看指定日期内AnalyticDB MySQL版集群下的SQL Pattern详情。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
请求参数
名称 | 类型 | 是否必选 | 示例值 | 描述 |
---|---|---|---|---|
Action | String | 是 | DescribeSqlPattern |
系统规定参数。取值:DescribeSqlPattern。 |
StartTime | String | 是 | 2021-08-30 |
需要查询的日期,格式为yyyy-MM-dd(UTC时间)。 说明 仅支持查看30天内的数据。
|
Order | String | 否 | [{"Field":"Pattern","Type":"Asc"}] |
将查询结果按指定字段进行排序。格式为JSON字符串,例如
说明
|
PageNumber | Integer | 否 | 1 |
页码,取值为大于0且不超过Integer数据类型的最大值。默认值为1。 |
SqlPattern | String | 否 | SELECT |
需要包含的SQL Pattern的关键字。 说明 若该参数不填,默认返回目标集群在
StartTime 参数所设日期内的所有SQL Pattern详情。
|
Type | String | 否 | user |
按指定维度来聚合SQL Pattern。支持如下取值:
说明 若该参数不填,默认按照
user 维度聚合。
|
DBClusterId | String | 是 | am-bp1r053byu48p**** |
集群ID。 说明 您可以调用DescribeDBClusters接口查看目标地域下所有AnalyticDB MySQL集群的详情,包括集群ID。
|
PageSize | Integer | 否 | 30 |
每页记录数,取值为任意正整数。默认为30。 |
RegionId | String | 是 | cn-hangzhou |
地域ID。 说明 您可以调用DescribeRegions接口查看AnalyticDB MySQL版支持的地域和可用区信息,包括地域ID。
|
返回数据
名称 | 类型 | 示例值 | 描述 |
---|---|---|---|
PageSize | Integer | 30 |
本页记录数。 |
PageNumber | Integer | 1 |
页数。 |
TotalCount | Integer | 1 |
总记录数。 |
Items | Array of Items |
SQL Pattern详情。 |
|
AvgStageCount | String | 2 |
平均Stage个数。 |
MaxCpuTime | String | 17 |
最大计算耗时,单位:ms。 |
AccessIP | String | 100.104.***.*** |
客户端IP。 说明 仅当
Type 参数设置为accessip 时,支持返回该参数。
|
AvgScanSize | String | 0 |
平均扫描量,单位:KB。 |
MaxScanSize | String | 0 |
最大扫描量,单位:KB。 |
MaxPeakMemory | String | 480096 |
最大峰值内存,单位:KB。 |
AvgCpuTime | String | 1.0625 |
平均计算耗时,单位:ms。 |
User | String | test_acc |
用户名。 说明 仅当
Type 参数留空或设置为user 时,支持返回该参数。
|
AvgPeakMemory | String | 240048 |
平均峰值内存,单位:KB。 |
MaxStageCount | String | 2 |
最大Stage个数。 |
MaxTaskCount | String | 2 |
最大Task个数。 |
InstanceName | String | am-bp1r053byu48p**** |
集群ID。 |
QueryCount | String | 16 |
查询总数。 |
ReportDate | String | 2021-08-30 |
查询日期。 |
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 |
SQL Pattern。 |
AvgTaskCount | String | 2 |
平均Task个数。 |
RequestId | String | B6F2D1B4-2C9F-5622-B424-5E7965****** |
请求ID。 |
示例
请求示例
http(s)://adb.aliyuncs.com/?Action=DescribeSqlPattern
&StartTime=2021-08-30
&DBClusterId=am-bp1r053byu48p****
&RegionId=cn-hangzhou
&公共请求参数
正常返回示例
XML
格式
HTTP/1.1 200 OK
Content-Type:application/xml
<DescribeSqlPatternResponse>
<PageSize>30</PageSize>
<PageNumber>1</PageNumber>
<TotalCount>1</TotalCount>
<Items>
<AvgStageCount>2</AvgStageCount>
<MaxCpuTime>17</MaxCpuTime>
<AccessIP>100.104.***.***</AccessIP>
<AvgScanSize>0</AvgScanSize>
<MaxScanSize>0</MaxScanSize>
<MaxPeakMemory>480096</MaxPeakMemory>
<AvgCpuTime>1.0625</AvgCpuTime>
<User>test_acc</User>
<AvgPeakMemory>240048</AvgPeakMemory>
<MaxStageCount>2</MaxStageCount>
<MaxTaskCount>2</MaxTaskCount>
<InstanceName>am-bp1r053byu48p****</InstanceName>
<QueryCount>16</QueryCount>
<ReportDate>2021-08-30</ReportDate>
<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>
<AvgTaskCount>2</AvgTaskCount>
</Items>
<RequestId>B6F2D1B4-2C9F-5622-B424-5E7965******</RequestId>
</DescribeSqlPatternResponse>
JSON
格式
HTTP/1.1 200 OK
Content-Type:application/json
{
"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******"
}
错误码
访问错误中心查看更多错误码。