Updated on 2025-11-24 GMT+08:00

Querying Historical Transactions

Function

  • This API is used to query historical transactions.
  • Currently, this API is only available to RDS for MySQL. Only historical transactions in the last seven days can be viewed.

URI

GET /v3/{project_id}/instances/{instance_id}/transaction

Table 1 URI parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Explanation:

Project ID of a tenant in a region.

To obtain this value, see Obtaining a Project ID.

Constraints:

N/A

Values:

The value can contain 32 characters. Only letters and digits are allowed.

Default value:

N/A

instance_id

Yes

String

Explanation:

Unique ID of an instance

Constraints:

N/A

Values:

The value can contain 32 characters. Only letters and digits are allowed.

Default value:

N/A

Table 2 Query parameters

Parameter

Mandatory

Type

Description

datastore_type

Yes

String

Explanation:

Database type

Constraints:

N/A

Values:

Only RDS for MySQL is supported.

Default value:

N/A

start_at

Yes

Long

Explanation:

Collection start time

Constraints:

Unix timestamp, in milliseconds

Values:

[0, 2^31-1]. The actual value depends on the query result.

Default value:

N/A

end_at

Yes

Long

Explanation:

Collection end time

Constraints:

Unix timestamp, in milliseconds

Values:

[0, 2^31-1]. The actual value depends on the query result.

Default value:

N/A

page_num

No

Integer

Explanation:

Number of pages

Constraints:

N/A

Values:

[1, 2^31-1]

Default value:

N/A

page_size

No

Integer

Explanation:

Page size

Constraints:

N/A

Values:

5, 10, 20, and 50

Default value:

N/A

order

No

String

Explanation:

Sorting field

Constraints:

N/A

Values:

N/A

Default value:

N/A

order_by

No

String

Explanation:

Sorting order, which can be ascending or descending

Constraints:

N/A

Values:

  • asc
  • desc

Default value:

N/A

last_sec_min

No

Long

Explanation:

Minimum duration

Constraints:

N/A

Values:

N/A

Default value:

N/A

last_sec_max

No

Long

Explanation:

Maximum duration

Constraints:

N/A

Values:

N/A

Default value:

N/A

Request Parameters

None

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

total

Integer

Explanation:

Total number of historical transactions

Values:

[0, 2^31-1]

transaction_info_list

Array of Table 4 objects

Explanation:

Historical transaction information

Values:

N/A

Table 4 transaction_info_list

Parameter

Type

Description

last_sec

Integer

Explanation:

Transaction duration

Values:

N/A

wait_locks

Integer

Explanation:

Number of wait locks

Values:

N/A

hold_locks

Integer

Explanation:

Number of held locks

Values:

N/A

occurrence_time

Integer

Explanation:

Occurrence time

Values:

N/A

detail

String

Explanation:

Transaction content

Values:

N/A

collect_time

Long

Explanation:

Collection time

Values:

N/A

Example Request

Querying historical transactions

"GET https://das.cn-north-1.myhuaweicloud.com/v3/054c630ff780d4cc2f40c00d7f6fb21d/instances/a77c88dcfd404a64a466ca2cd2f5b8e5in01/transaction?datastore_type=MySQL&start_at=1&end_at=1717399020000"

Example Response

Status code: 200

Successful request

{
  "total": 1,
  "transaction_info_list": [
    {
      "collect_time": 1717398965000,
      "last_sec": 5,
      "wait_locks": 3,
      "hold_locks": 3,
      "occurrence_time": 1717398965000,
      "detail": "MySQL thread id 17485282, OS thread handle 140455451772672, query id 48549222 xxx root updating\ndelete from dead_lock_test where v1 = 5 and v2 = 5\n*** HOLDS THE LOCK:\nRECORD LOCKS space id 34691 page no 3 n bits 80 index PRIMARY of table `at_cloud_dba_001`.`dead_lock_test` trx id 690888 lock_mode X locks rec but not gap\nRecord lock, heap no 7 PHYSICAL RECORD: n_fields 5; compact format; info bits 0\n"
    }
  ]
}

Status Codes

Status Code

Description

200

Successful request

400

Client error

500

Server error

Error Codes

See Error Codes.