调用DescribeSlowLogs接口查询PolarDB集群的慢日志统计信息。

说明 仅PolarDB MySQL版支持该接口。

调试

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

请求参数

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

系统规定参数。取值:DescribeSlowLogs

RegionId String cn-hangzhou

地域ID。

DBClusterId String pc-****************

集群ID。

StartTime String 2021-05-01Z

查询开始日期,格式:yyyy-MM-ddZ(UTC时间)。

EndTime String 2021-05-30Z

查询结束日期,不能小于查询开始日期,与查询开始日期间隔不超过31天。格式:yyyy-MM-ddZ(UTC时间)。

DBName String PolarDB_MySQL

数据库名称。

PageSize Integer 30

每页记录数,取值:30~100。默认值:30。

PageNumber Integer 1

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

默认值:1。

返回数据

名称 类型 示例值 描述
TotalRecordCount Integer 5

总记录数。

PageRecordCount Integer 6

本页SQL语句个数。

EndTime String 2021-05-30Z

查询结束日期。

RequestId String 2553A660-E4EB-4AF4-A402-8AFF70A49143

请求ID。

PageNumber Integer 3

页码。

StartTime String 2021-05-01Z

查询开始日期。

DBClusterId String pc-****************

集群ID。

Items Array of SQLSlowLog

慢日志信息列表。

SQLSlowLog
SQLText String select id,name from tb_table

SQL语句。

ReturnMaxRowCount Long 3

返回的SQL行数(最大值)。

CreateTime String 2021-05-30Z

数据生成日期。

MaxExecutionTime Long 60

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

ParseTotalRowCounts Long 2

解析的SQL行数(总值)。

TotalLockTimes Long 1

锁定时长(总值),单位:秒。

TotalExecutionTimes Long 2

执行时长(总值),单位:秒。

DBNodeId String pi-***************

节点ID。

SQLHASH String U2FsdGVkxxxx

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

ParseMaxRowCount Long 1

解析的SQL行数(最大值)。

MaxLockTime Long 1

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

ReturnTotalRowCounts Long 1

返回的SQL行数(总值)。

DBName String PolarDB_MySQL

数据库名称。

TotalExecutionCounts Long 2

执行次数(总值)。

Engine String polardb_mysql

数据库引擎。

示例

请求示例

http(s)://polardb.aliyuncs.com/?Action=DescribeSlowLogs
&RegionId=cn-hangzhou
&DBClusterId=pc-****************
&StartTime=2021-05-01Z
&EndTime=2021-05-30Z
&DBName=PolarDB_MySQL
&PageSize=30
&PageNumber=1
&<公共请求参数>

正常返回示例

XML格式

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

<DescribeSlowLogsResponse>
    <TotalRecordCount>5</TotalRecordCount>
    <PageRecordCount>6</PageRecordCount>
    <EndTime>2021-05-30Z</EndTime>
    <RequestId>2553A660-E4EB-4AF4-A402-8AFF70A49143</RequestId>
    <PageNumber>3</PageNumber>
    <StartTime>2021-05-01Z</StartTime>
    <DBClusterId>pc-****************</DBClusterId>
    <Items>
        <SQLText>select id,name from tb_table</SQLText>
        <ReturnMaxRowCount>3</ReturnMaxRowCount>
        <CreateTime>2021-05-30Z</CreateTime>
        <MaxExecutionTime>60</MaxExecutionTime>
        <ParseTotalRowCounts>2</ParseTotalRowCounts>
        <TotalLockTimes>1</TotalLockTimes>
        <TotalExecutionTimes>2</TotalExecutionTimes>
        <DBNodeId>pi-***************</DBNodeId>
        <SQLHASH>U2FsdGVkxxxx</SQLHASH>
        <ParseMaxRowCount>1</ParseMaxRowCount>
        <MaxLockTime>1</MaxLockTime>
        <ReturnTotalRowCounts>1</ReturnTotalRowCounts>
        <DBName>PolarDB_MySQL</DBName>
        <TotalExecutionCounts>2</TotalExecutionCounts>
    </Items>
    <Engine>polardb_mysql</Engine>
</DescribeSlowLogsResponse>

JSON格式

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

{
  "TotalRecordCount" : 5,
  "PageRecordCount" : 6,
  "EndTime" : "2021-05-30Z",
  "RequestId" : "2553A660-E4EB-4AF4-A402-8AFF70A49143",
  "PageNumber" : 3,
  "StartTime" : "2021-05-01Z",
  "DBClusterId" : "pc-****************",
  "Items" : [ {
    "SQLText" : "select id,name from tb_table",
    "ReturnMaxRowCount" : 3,
    "CreateTime" : "2021-05-30Z",
    "MaxExecutionTime" : 60,
    "ParseTotalRowCounts" : 2,
    "TotalLockTimes" : 1,
    "TotalExecutionTimes" : 2,
    "DBNodeId" : "pi-***************",
    "SQLHASH" : "U2FsdGVkxxxx",
    "ParseMaxRowCount" : 1,
    "MaxLockTime" : 1,
    "ReturnTotalRowCounts" : 1,
    "DBName" : "PolarDB_MySQL",
    "TotalExecutionCounts" : 2
  } ],
  "Engine" : "polardb_mysql"
}

错误码

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