Viewing slow log details

Last Updated: Dec 01, 2016

Description

Query slowlog details for a instance in a certain time range. Only the MySQL database is supported.

Request parameters

Name Type Required? Description
Action String Yes Required parameter. Value: DescribeSlowLogRecords
DBInstanceId String Yes Instance ID
StartTime String Yes Query start date. Format: YYYY-MM-DD’T’HH:mmZ, for example, 2011-06-11 T15:00Z
EndTime String Yes Query end date, which cannot be earlier than the query start date. Format: YYYY-MM-DD’T’HH:mmZ, for example, 2011-06-11 T16:00Z
DBName String No Name of a database
PageSize Integer No Number of records on every page. Values: 30, 50, and 100; default value: 30
PageNumber Integer No Page number, which must be greater than 0, but must not exceed the maximum Integer value. Default value: 1

Return parameters

Name Type Description
<Public Return Parameters> - For details, refer to the Appendix
Engine String Database type
TotalRecordCount Integer Total number of records
PageNumber Integer Page number
PageRecordCount Integer Number of SQL statements displayed on the current page
Items List<SQLSlowRecord> - -

SQLSlowLog parameters

Name Type Description
HostAddress String Host address used for database connection
DBName String Name of a database
SQLText String Query statement
QueryTimes Long Execution duration, in the unit of seconds
LockTimes Long Lock duration, in the unit of seconds
ParseRowCounts Long Number of parsed rows
ReturnRowCounts Long Number of returned rows
ExecutionStartTime String Execution start time. Format: YYYY-MM-DD’T’HH:mm:ss Z, for example, 2011-06-11 T15:00:08Z

Example

  • Request example
  1. https://rds.aliyuncs.com/?Action=DescribeSlowLogRecords
  2. &DBInstanceId=riauvjz6zajfiq6ba1370329449201
  3. &StartTime=2011-06-11T15:00Z
  4. &EndTime=2011-06-11T16:00Z
  5. &<Public Request Parameters>
  • Return example

XML format:

  1. <DescribeSlowLogRecordsResponse>
  2. <RequestId>542BB8D6-4268-45CC-A557-B03EFD7AB30A</RequestId>
  3. <DBInstanceID>riauvjz6zajfiq6ba1370329449201</DBInstanceID>
  4. <Engine>MySQL</Engine>
  5. <TotalRecordCount>1</TotalRecordCount>
  6. <PageNumber>1</PageNumber>
  7. <PageRecordCount>1</PageRecordCount>
  8. <Items>
  9. <SQLSlowRecord>
  10. <HostAddress>192.168.0.123</HostAddress>
  11. <DBName>test</DBName>
  12. <SQLText>update test.zxb set id=0 limit 1</SQLText>
  13. <QueryTimes>123</QueryTimes>
  14. <LockTimes>12</LockTimes>
  15. <ParseRowCounts>125</ParseRowCounts>
  16. <ReturnRowCounts>1</ReturnRowCounts>
  17. <ExecutionStartTime>2011-06-11T15:00:08Z</ExecutionStartTime>
  18. </SQLSlowRecord>
  19. </Items>
  20. </DescribeSlowLogRecordsResponse>

JSON format:

  1. {
  2. "RequestId":"542BB8D6-4268-45CC-A557-B03EFD7AB30A"
  3. "Engine":"MySQL",
  4. "PageNumber":1,
  5. "PageRecordCount":1,
  6. "TotalRecordCount":1
  7. "Items":
  8. {"SQLSlowRecord":
  9. [
  10. {
  11. HostAddress:”192.168.0.123
  12. DBName:”test
  13. SQLText:” update test.zxb set id=0 limit 1
  14. QueryTimes:”123
  15. LockTimes12
  16. ParseRowCounts:”125
  17. ReturnRowCounts:”1
  18. ExecutionStartTime:”2011-06-11T15:00:08Z
  19. }
  20. ]
  21. }
  22. }
Thank you! We've received your feedback.