View the slow log list

Last Updated: Dec 06, 2017

Description

Query a summary of slow queries for a database under a user instance in a certain time range, and this operation supports querying by page.

Slow queries return different SQLSlowLog parameter values for the SQL Server and MySQL instances. For details, see the SQLSlowLog parameter table below.

Request parameters

Name Type Required? Description
Action String Yes Required parameter. Value: DescribeSlowLogs.
DBInstanceId String Yes Instance ID.
StartTime String Yes Query start date. Format: YYYY-MM-DDZ, for example, 2011-05-30Z.
EndTime String Yes Query end date, which cannot be earlier than the query start date. Format: YYYY-MM-DDZ, for example, 2011-05-30Z.
DBName String No Name of a database.
SortKey String No Sorting basis. Values are as follows:
  • TotalExecutionCounts: sorting in the descending order of execution times;
  • TotalQueryTimes: sorting in the descending order of the total execution duration;
  • TotalLogicalReads: sorting in the descending order of the total number of logical reads;
  • TotalPhysicalReads: sorting in the descending order of the total number of physical reads. This parameter is effective for SQL Server instances and must be used for SQL Server instances.
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, see Public parameters.
Engine String Database type.
StartTime String Query start date. Format: YYYY-MM-DDZ, for example, 2011-05-30Z.
EndTime String Query end date. Format: YYYY-MM-DDZ, for example, 2011-05-30Z.
TotalRecordCount Integer Total number of records.
PageNumber Integer Page number.
PageRecordCount Integer Number of SQL statements displayed on the current page.
Items List<SQLSlowLog> - -

SQLSlowLog parameters for MySQL

Name Type Description
DBName String Name of a database.
SQLText String Query statement.
MySQLTotalExecutionCounts Long Total number of execution times.
MySQLTotalExecutionTimes Long Total execution duration, in the unit of seconds.
MaxExecutionTime Long Maximum execution duration, in the unit of seconds.
TotalLockTimes Long Total lock duration, in the unit of seconds.
MaxLockTime Long Maximum lock duration, in the unit of seconds.
ParseTotalRowCounts Long Total number of parsed rows.
ParseMaxRowCount Long Maximum number of parsed rows.
ReturnTotalRowCounts Long Total number of returned rows.
ReturnMaxRowCount Long Maximum number of returned rows.
CreateTime String Data generation date. Format: “yyyy-MM-ddZ”, for example, 2011-05-30Z.

SQLSlowLog for SQL Server

Name Type Description
SQLText String Query statement.
SQLServerTotalExecutionCounts Long Total number of execution times.
SQLServerTotalExecutionTimes Long Total execution duration, in the unit of milliseconds.
TotalLogicalReadcounts Long Total number of logical reads.
TotalPhysicalReadcounts Long Total number of physical reads.
ReportTime String Data report generation date. Format: “yyyy-MM-ddZ”, for example, 2011-05-30Z.

Example

  • Request example

    1. https://rds.aliyuncs.com/?Action=DescribeSlowLogs
    2. &DBInstanceId=riauvjz6zajfiq6ba1370329449201
    3. &StartTime=2011-06-11Z
    4. &EndTime=2011-12-11Z
    5. &SortKey= TotalExecutionCounts
    6. &<Public Request Parameters>
  • Return example

    XML format:

    1. <DescribeSlowLogsResponse>
    2. <RequestId>A5409D02-D661-4BF3-8F3D-0A814D0574E7</RequestId>
    3. <DBInstanceID>riauvjz6zajfiq6ba1370329449201</DBInstanceID>
    4. <Engine>SQLServer</Engine>
    5. <StartTime>2011-06-11Z</StartTime>
    6. <EndTime>2011-12-11Z</EndTime>
    7. <TotalRecordCount>1</TotalRecordCount>
    8. <PageNumber>1</PageNumber>
    9. <PageRecordCount>1</PageRecordCount>
    10. <Items>
    11. <SQLSlowLog>
    12. <SQLText>update test.zxb set id=0 limit 1</SQLText>
    13. <SQLServerTotalExecutionCounts>178</SQLServerTotalExecutionCounts>
    14. <SQLServerTotalExecutionTimes>189</SQLServerTotalExecutionTimes>
    15. <TotalLogicalReadcounts>89</TotalLogicalReadcounts>
    16. <TotalPhysicalReadcounts>90</TotalPhysicalReadcounts>
    17. <ReportTime>2013-11-12Z</ReportTime>
    18. </SQLSlowLog>
    19. </Items>
    20. </DescribeSlowLogsResponse>

    JSON format:

    1. {
    2. "RequestId":"A5409D02-D661-4BF3-8F3D-0A814D0574E7"
    3. "StartTime":"2011-06-11Z ",
    4. "EndTime":"2011-12-11Z ",
    5. "Engine":"SQLServer",
    6. "PageNumber":1,
    7. "PageRecordCount":1,
    8. "TotalRecordCount"1,
    9. "Items":
    10. {"SQLSlowLog":
    11. [
    12. { "SQLText":”update test.zxb set id=0 limit 1
    13. "SQLServerTotalExecutionCounts":178
    14. "SQLServerTotalExecutionTimes":189
    15. "TotalLogicalReadcounts":89
    16. "TotalPhysicalReadcounts":90
    17. "ReportTime":"2013-11-12Z "
    18. }
    19. ]
    20. }
    21. }
Thank you! We've received your feedback.