Querying Slow Query Log Statistics

Function

This API is used to query slow query log statistics of a DB instance.

Constraints

This API is available only to RDS for MySQL and RDS for PostgreSQL.

URI

Request

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

Content-Type

Yes

String

The content type.

The default value is application/json.

X-Auth-Token

Yes

String

Specifies the user token.

The user token is a response to the API used to obtain a user token.

Table 3 Parameter description

Name

Mandatory

Type

Description

start_time

Yes

String

Start 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.

end_time

Yes

String

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. You can only query slow logs generated within a month.

offset

No

Integer

Index offset. The default value is 0, indicating that the query starts from the first piece of data.

limit

No

Integer

Number of records (query results) displayed on each page. The number ranges from 1 to 100. The default value is 10.

type

No

String

Statement type. If this parameter is left empty, all statement types are queried.

Enumerated values:

  • INSERT
  • UPDATE
  • SELECT
  • DELETE
  • CREATE
  • ALL

database

No

String

Database name. It cannot contain special characters such as < > &.

sort

No

String

Sorting field.

  • executeTime: indicates sorting slow query logs by average execution time in descending order.
  • If this parameter is left empty or set to other values, the slow query logs are sorted by executions in descending order.

order

No

String

Sorting sequence. The default value is desc.

Enumerated values:

  • desc
  • asc

Example Request

Query slow query log statistics. Each page contains 10 records.
POST https://rds.eu-de.otc.t-systems.com/v3.1/0483b6b16e954cb88930a360d2c4e663/instances/cee5265e1e5845649e354841234567dfin01/slow-logs/statistics
{
    "start_time":"2023-01-05T08:00:00+0800",
    "end_time":"2023-01-11T20:00:00+0800",
    "limit":10,
    "order":"asc"
}

Response

Status Code

Error Code

For details, see Error Codes.