开发者社区> 问答> 正文

API参考 - API参考 - 日志管理 - DescribeSlowLogs



描述


用户可以查询某日期范围内、某个用户实例下、某个DB的慢查询汇总情况,支持分页查询。对于SQL Server和MySQL两种实例类型,慢查询返回的SQLSlowLog参数值是不一样的,详情请见下面的SQLSlowLog参数表。

请求参数

[tr=rgb(51, 205, 229)][td]名称 类型是否必须描述ActionString是系统规定参数,取值:DescribeSlowLogs。DBInstanceIdString是实例名。StartTimeString是查询开始日期,格式:YYYY-MM-DDZ,如2011-05-30Z。EndTimeString是查询结束日期,不能小于查询开始日期,格式:YYYY-MM-DDZ,如2011-05-30Z。DBNameString否DB名称。SortKeyString否排序依据,取值如下:
  • TotalExecutionCounts:总执行次数最多;
  • TotalQueryTimes:总执行时间最多
  • TotalLogicalReads:总逻辑读最多;
  • TotalPhysicalReads:总物理读最多。此参数对SQL Server实例有效,SQL Server类型必传此参数。
PageSizeInteger否每页记录数,取值:30/50/100;默认值:30。PageNumberInteger否页码,大于0且不超过Integer的最大值;默认值:1。

返回参数

[tr=rgb(51, 205, 229)][td]名称 类型描述<公共返回参数>详见公共参数。EngineString数据库类型。StartTimeString查询开始日期,格式:YYYY-MM-DDZ,如2011-05-30Z。EndTimeString查询结束日期,格式:YYYY-MM-DDZ,如2011-05-30Z。TotalRecordCountInteger总记录数。PageNumberInteger页码。PageRecordCountInteger本页SQL语句个数。Items

List<SQLSlowLog>

SQLSlowLog参数

[tr=rgb(51, 205, 229)][td]名称 类型描述DBNameStringDB名称。SQLTextString查询语句。MySQLTotalExecutionCountsLong执行总次数。MySQLTotalExecutionTimesLong执行总时长,单位:秒。MaxExecutionTimeLong执行最大时长,单位:秒。TotalLockTimesLong锁定总时长,单位:秒。MaxLockTimeLong锁定最大时长,单位:秒。ParseTotalRowCountsLong解析总行数。ParseMaxRowCountLong解析最大行数。ReturnTotalRowCountsLong返回总行数。ReturnMaxRowCountLong返回最大行数。CreateTimeString数据生成日期,格式:”yyyy-MM-ddZ”,如2011-05-30Z。

SQLSlowLog参数

[tr=rgb(51, 205, 229)][td]称 类型描述SQLTextString查询语句。SQLServerTotalExecutionCountsLong总执行次数。SQLServerTotalExecutionTimesLong总执行时间,单位:毫秒。TotalLogicalReadcountsLong总逻辑读。TotalPhysicalReadcountsLong总物理读。ReportTimeString数据报表生成日期;格式:”yyyy-MM-ddZ”,如2011-05-30Z。

请求示例



https://rds.aliyuncs.com/?Action=DescribeSlowLogs
&DBInstanceId=riauvjz6zajfiq6ba1370329449201
&StartTime=2011-06-11Z
&EndTime=2011-12-11Z
&SortKey= TotalExecutionCounts
&<公共请求参数>




https://rds.aliyuncs.com/?Action=DescribeSlowLogs
&DBInstanceId=riauvjz6zajfiq6ba1370329449201
&StartTime=2011-06-11Z
&EndTime=2011-12-11Z
&SortKey= TotalExecutionCounts
&<公共请求参数>

返回示例



XML格式 <DescribeSlowLogsResponse>
  <RequestId>A5409D02-D661-4BF3-8F3D-0A814D0574E7</RequestId>
  <DBInstanceID>riauvjz6zajfiq6ba1370329449201</DBInstanceID>
  <Engine>SQLServer</Engine>
  <StartTime>2011-06-11Z</StartTime>
  <EndTime>2011-12-11Z</EndTime>
  <TotalRecordCount>1</TotalRecordCount>
  <PageNumber>1</PageNumber>
  <PageRecordCount>1</PageRecordCount>
  <Items>
    <SQLSlowLog>
    <SQLText>update test.zxb set id=0 limit 1</SQLText>
    <SQLServerTotalExecutionCounts>178</SQLServerTotalExecutionCounts>
    <SQLServerTotalExecutionTimes>189</SQLServerTotalExecutionTimes>
    <TotalLogicalReadcounts>89</TotalLogicalReadcounts>
    <TotalPhysicalReadcounts>90</TotalPhysicalReadcounts>
    <ReportTime>2013-11-12Z</ReportTime>
   </SQLSlowLog>
  </Items>
</DescribeSlowLogsResponse>





JSON格式 {
    "RequestId":"A5409D02-D661-4BF3-8F3D-0A814D0574E7"
"StartTime":"2011-06-11Z ",
"EndTime":"2011-12-11Z ",
"Engine":"SQLServer",
"PageNumber":1,
"PageRecordCount":1,
"TotalRecordCount":1,
"Items":
{"SQLSlowLog":
[
{ "SQLText":”update test.zxb set id=0 limit 1”
"SQLServerTotalExecutionCounts":178
"SQLServerTotalExecutionTimes":189
"TotalLogicalReadcounts":89
"TotalPhysicalReadcounts":90
"ReportTime":"2013-11-12Z "
}
]
}
}




展开
收起
梨好橙 2018-09-14 23:05:57 1915 0
0 条回答
写回答
取消 提交回答
问答排行榜
最热
最新

相关电子书

更多
CUDA MATH API 立即下载
API PLAYBOOK 立即下载
传统企业的“+互联网”-API服务在京东方的实践 立即下载