tencent cloud

Feedback

DescribeDBSlowLogs

Last updated: 2022-06-17 17:25:49

1. API Description

Domain name for API request: mariadb.tencentcloudapi.com.

This API is used to query the list of slow query logs.

A maximum of 20 requests can be initiated per second for this API.

We recommend you to use API Explorer
Try it
API Explorer provides a range of capabilities, including online call, signature authentication, SDK code generation, and API quick search. It enables you to view the request, response, and auto-generated examples.

2. Input Parameters

The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.

Parameter Name Required Type Description
Action Yes String Common Params. The value used for this API: DescribeDBSlowLogs.
Version Yes String Common Params. The value used for this API: 2017-03-12.
Region Yes String Common Params. For more information, please see the list of regions supported by the product.
InstanceId Yes String Instance ID in the format of tdsql-ow728lmc.
Offset Yes Integer Data entry number starting from which to return results
Limit Yes Integer Number of results to be returned
StartTime Yes Timestamp Query start time in the format of 2016-07-23 14:55:20
EndTime No Timestamp Query end time in the format of 2016-08-22 14:55:20
Db No String Specific name of the database to be queried
OrderBy No String Sorting metric. Valid values: query_time_sum, query_count
OrderByType No String Sorting order. Valid values: desc, asc
Slave No Integer Query slow queries from either the primary or the replica. Valid values: 0 (primary), 1 (replica)

3. Output Parameters

Parameter Name Type Description
Data Array of SlowLogData Slow query log data
LockTimeSum Float Total statement lock time
QueryCount Integer Total number of statement queries
Total Integer Total number of results
QueryTimeSum Float Total statement query time
RequestId String The unique request ID, which is returned for each request. RequestId is required for locating a problem.

4. Example

Example1 Querying slow query log list

Input Example

https://mariadb.tencentcloudapi.com/?Action=DescribeDBSlowLogs
&InstanceId=tdsql-ige1a5k3
&Offset=0
&Limit=20
&StartTime=2017-08-06 00:00:00
&EndTime=2017-08-07 23:59:59
&Slave=1
&<Common request parameters>

Output Example

{
  "Response": {
    "LockTimeSum": 0.0,
    "QueryCount": 1,
    "QueryTimeSum": 1.13,
    "RequestId": "1e74e824-6d2b-495d-b347-5250cdf8e964",
    "Total": 1,
    "Data": [
      {
        "CheckSum": "14090621765287179955",
        "Db": "",
        "FingerPrint": "replace into sysdb.statustable set ts = from_unixtime(?),ip=?,port=?",
        "LockTimeAvg": "0.00",
        "LockTimeMax": "0.00",
        "LockTimeMin": "0.00",
        "LockTimeSum": "0.00",
        "QueryCount": "1",
        "QueryTimeAvg": "1.13",
        "QueryTimeMax": "1.13",
        "QueryTimeMin": "1.13",
        "QueryTimeSum": "1.13",
        "RowsExaminedSum": "0.00",
        "RowsSentSum": "0.00",
        "TsMax": "2016-08-06 11:32:10",
        "TsMin": "2016-08-06 11:32:10",
        "User": "agent",
        "Host": "10.1.1.1",
        "ExampleSql": ""
      }
    ]
  }
}

5. Developer Resources

SDK

TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.

Command Line Interface

6. Error Code

The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.

Error Code Description
InternalError.CamAuthFailed CAM authentication request failed.
InternalError.DbOperationFailed Failed to query the database.
InternalError.GetInstanceInfoFailed Failed to get the backend instance information.
InternalError.GetSlowLogFailed Failed to get the error log.
InternalError.LogDBFailed Failed to get the slow log.
InvalidParameter.GenericParameterError An error occurred while verifying parameter validity.
InvalidParameter.IllegalTime The time parameter is incorrect.
ResourceUnavailable.InstanceAlreadyDeleted The database instance has been deleted.
ResourceUnavailable.InstanceStatusAbnormal Incorrect database instance status. Operations are not allowed.
UnauthorizedOperation.PermissionDenied You have no permission to manipulate this API or resource.
Contact Us

Contact our sales team or business advisors to help your business.

Technical Support

Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

7x24 Phone Support