该接口用于查询POLARDB集群的慢日志统计信息。

调用该接口时,集群必须为MySQL 5.6或8.0版本。

调试

您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。

请求参数

名称 类型 是否必选 示例值 描述
Action String DescribeSlowLogs

系统规定参数,取值:DescribeSlowLogs

DBClusterId String pc-bp1w2u4xxxxxxxxxx

集群ID。

RegionId String cn-hangzhou

地域ID。

说明 可通过接口DescribeRegions查看可用的地域。
StartTime String 2019-11-18Z

查询开始日期,格式:yyyy-MM-ddZ。

EndTime String 2019-12-18Z

查询结束日期,需要晚于查询开始日期,与查询开始日期间隔不超过31天。格式:yyyy-MM-ddZ。

AccessKeyId String LTAIfCxxxxxxxxxx

阿里云颁发给用户的访问服务所用的密钥ID。

DBName String testdb

数据库名称。

PageSize Integer 30

每页记录数,取值:

  • 30
  • 50
  • 100

默认值:30

PageNumber Integer 1

页码,取值:大于0且不超过Integer的最大值。

默认值:1

返回数据

名称 类型 示例值 描述
RequestId String A95EC729-3644-4C05-BA29-55CBF1A4504C

请求ID。

DBClusterId String pc-bp1w2u4xxxxxxxxxx

集群ID。

StartTime String 2019-11-18Z

查询开始日期。

EndTime String 2019-12-18Z

查询结束日期。

Engine String polardb_mysql

数据库引擎。

TotalRecordCount Integer 1

总记录数。

PageNumber Integer 1

页码。

PageRecordCount Integer 1

本页SQL语句个数。

Items Array

慢日志信息列表。

DBNodeId String pi-bp13oz7xxxxxxxxxx

节点ID。

ParseMaxRowCount Long 0

解析SQL最大行数。

TotalLockTimes Long 0

锁定总时长,单位:秒。

DBName String testdb

数据库名称。

MaxExecutionTime Long 10597

最大执行时长,单位:秒。

SQLHASH String 50e94bcxxxxxxxxxxxxxxxx

慢日志统计里的SQL语句唯一标识符,可用于获取该SQL语句的慢日志明细。

SQLText String binlog dump

SQL语句。

CreateTime String 2019-11-27Z

数据生成日期。

TotalExecutionTimes Long 10597

总执行时间,单位:秒。

ReturnTotalRowCounts Long 0

返回SQL总行数。

TotalExecutionCounts Long 1

总执行次数。

MaxLockTime Long 0

最大锁定时长,单位:秒。

ReturnMaxRowCount Long 0

返回SQL最大行数。

ParseTotalRowCounts Long 0

解析SQL总行数。

示例

请求示例

http(s)://polardb.aliyuncs.com/?Action=DescribeSlowLogs
&DBClusterId=pc-bp1w2u4xxxxxxxxxx
&RegionId=cn-hangzhou
&StartTime=2019-11-18Z
&EndTime=2019-12-18Z
&<公共请求参数>

正常返回示例

JSON 格式

{
	"Items": {
		"SQLSlowLog": [
			{
				"ParseMaxRowCount": 0,
				"TotalExecutionTimes": 10597,
				"TotalExecutionCounts": 1,
				"SQLText": "binlog dump",
				"MaxLockTime": 0,
				"ReturnTotalRowCounts": 0,
				"TotalLockTimes": 0,
				"MaxExecutionTime": 10597,
				"CreateTime": "2019-11-27Z",
				"ParseTotalRowCounts": 0,
				"DBName": "",
				"SQLHASH": "50e94bcxxxxxxxxxxxxxxxx",
				"ReturnMaxRowCount": 0,
				"DBNodeId": "pi-bp13oz7xxxxxxxxxx"
			}
		]
	},
	"TotalRecordCount": 1,
	"PageNumber": 1,
	"RequestId": "A95EC729-3644-4C05-BA29-55CBF1A4504C",
	"EndTime": "2019-12-18Z",
	"StartTime": "2019-11-18Z",
	"DBClusterId": "pc-bp1w2u4xxxxxxxxxx",
	"Engine": "polardb_mysql",
	"PageRecordCount": 1
}

XML 格式

<Items>
    <SQLSlowLog>
        <ParseMaxRowCount>0</ParseMaxRowCount>
        <TotalExecutionTimes>10597</TotalExecutionTimes>
        <TotalExecutionCounts>1</TotalExecutionCounts>
        <SQLText>binlog dump</SQLText>
        <MaxLockTime>0</MaxLockTime>
        <ReturnTotalRowCounts>0</ReturnTotalRowCounts>
        <TotalLockTimes>0</TotalLockTimes>
        <MaxExecutionTime>10597</MaxExecutionTime>
        <CreateTime>2019-11-27Z</CreateTime>
        <ParseTotalRowCounts>0</ParseTotalRowCounts>
        <DBName/>
        <SQLHASH>50e94bcxxxxxxxxxxxxxxxx</SQLHASH>
        <ReturnMaxRowCount>0</ReturnMaxRowCount>
        <DBNodeId>pi-bp13oz7xxxxxxxxxx</DBNodeId>
    </SQLSlowLog>
</Items>
<TotalRecordCount>1</TotalRecordCount>
<PageNumber>1</PageNumber>
<RequestId>A95EC729-3644-4C05-BA29-55CBF1A4504C</RequestId>
<EndTime>2019-12-18Z</EndTime>
<StartTime>2019-11-18Z</StartTime>
<DBClusterId>pc-bp1w2u4xxxxxxxxxx</DBClusterId>
<Engine>polardb_mysql</Engine>
<PageRecordCount>1</PageRecordCount>

错误码

访问错误中心查看更多错误码。