Updated on 2022-12-08 GMT+08:00

Obtaining Slow Query Log Statistics

Function

This API is used to query and collect statistics on slow query logs based on service requirements.

Constraints

This API is supported for MySQL only.

URI

  • URI format

    GET https://{Endpoint}/v3/{project_id}/instances/{instance_id}/slowlog/statistics?cur_page={cur_page}&per_page={per_page}&type={type}&start_date={start_date}&end_date={end_date}

  • Example

    https://rds.my-kualalumpur-1.alphaedge.tmone.com.my/v3/0483b6b16e954cb88930a360d2c4e663/instances/cee5265e1e5845649e354841234567dfin01/slowlog/statistics?cur_page=1&per_page=2&type=INSERT&start_date=2020-02-06T10:41:14+0800&end_date=2020-02-07T10:41:14+0800

  • Parameter description
    Table 1 Parameter description

    Name

    Mandatory

    Description

    project_id

    Yes

    Specifies the project ID of a tenant in a region.

    For details about how to obtain the project ID, see Obtaining a Project ID.

    instance_id

    Yes

    Specifies the ID of the DB instance to be queried.

    cur_page

    Yes

    Specifies the page offset (the current page number, such as 1, 2, 3, or 4.)

    per_page

    Yes

    Specifies the number of records on each page. The value ranges from 0 to 100.

    start_date

    Yes

    Specifies the start date in the "yyyy-mm-ddThh:mm:ssZ" format.

    T is the separator between the calendar and the hourly notation of time. Z indicates the time zone offset.

    end_date

    Yes

    Specifies the end time in the "yyyy-mm-ddThh:mm:ssZ" format.

    T is the separator between the calendar and the hourly notation of time. Z indicates the time zone offset.

    type

    Yes

    Specifies the statement type. If it is left blank, all statement types are queried. Valid value:

    • INSERT
    • UPDATE
    • SELECT
    • DELETE
    • CREATE

Request

None

Response

  • Normal response
    Table 2 Description

    Name

    Type

    Description

    pageNumber

    Integer

    Indicates the current page number.

    pageRecord

    Integer

    Indicates the number of records on each page.

    slowLogList

    List

    See Table 3.

    totalRecord

    Integer

    Indicates the total number of records.

    startTime

    Long

    Indicates the start time.

    endTime

    Long

    Indicates the end time.

  • Example normal response
    {
    	"pageNumber": 1,
    	"pageRecord": 10,
    	"slowLogList": [],
    	"totalRecord": 0,
            "startTime": null,
            "endTime":null
    }
  • Abnormal response

    For details, see Abnormal Request Results.

Status Code

For details, see Status Codes.

Error Code

For details, see Error Codes.