Updated on 2026-11-27 GMT+08:00

Querying Killed Sessions

Function

This API is used to query killed sessions. Before calling this API:

Calling Method

For details, see Calling APIs.

Authorization Information

Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions.

  • If you are using role/policy-based authorization, see Permissions and Supported Actions for details on the required permissions.
  • If you are using identity policy-based authorization, the following identity policy-based permissions are required.

    Action

    Access Level

    Resource Type (*: required)

    Condition Key

    Alias

    Dependency

    gaussdbformysql:instance:get

    Read

    instance *

    • g:EnterpriseProjectId

    • g:ResourceTag/<tag-key>

    gaussdb:instance:list

    -

URI

GET /v3/{project_id}/instances/{instance_id}/process/kill/history

Table 1 URI parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Definition

Project ID of a tenant in a region.

To obtain this value, see Obtaining a Project ID.

Constraints

N/A

Range

The value contains 32 characters. Only letters and digits are allowed.

Default Value

N/A

instance_id

Yes

String

Definition

Instance ID, which uniquely identifies an instance.

To obtain this value, see Querying DB Instances.

Constraints

N/A

Range

The value contains 36 characters with a suffix of in07. Only letters and digits are allowed.

Default Value

N/A

Table 2 Query parameters

Parameter

Mandatory

Type

Description

start_time

No

Long

Definition

Start time for killed sessions.

Constraints

  • The value is a Unix timestamp, in milliseconds.

  • start_time must be earlier than end_time.

Range

N/A

Default Value

N/A

end_time

No

Long

Definition

End time for killed sessions.

Constraints

  • The value is a Unix timestamp, in milliseconds.

  • end_time must be later than start_time.

Range

N/A

Default Value

N/A

page_num

No

Integer

Definition

Current page number.

Constraints

The value must be an integer and cannot be a negative number.

Range

≥ 0

Default Value

1

page_size

No

Integer

Definition

Size of each page.

Constraints

The value must be an integer and cannot be a negative number.

Range

1–100

Default Value

10

Request Parameters

Table 3 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Definition

User token. To obtain this value, call the IAM API for obtaining a user token.

The value of X-Subject-Token in the response header is the token value.

Constraints

N/A

Range

N/A

Default Value

N/A

X-Language

No

String

Definition

Request language type.

Constraints

N/A

Range

  • en-us: English

  • zh-cn: Chinese

Default Value

en-us

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

total_count

Integer

Definition

Total number of historical records.

Range

N/A

processes

Array of KillProcessHistoryItem objects

Definition

List of historical records.

Table 5 KillProcessHistoryItem

Parameter

Type

Description

task_id

String

Definition

ID of the automatic killing task.

Range

N/A

session_id

String

Definition

Session ID.

Range

N/A

kill_time

String

Definition

Timestamp when the session was killed.

Range

N/A

mode

String

Definition

Killing method.

Range

  • once: Sessions are killed at once.

  • condition: Sessions are killed based on conditions.

user

String

Definition

User.

Range

N/A

host

String

Definition

Host.

Range

N/A

db

String

Definition

Database name.

Range

N/A

command

String

Definition

Command.

Range

N/A

time

String

Definition

Session duration, in seconds.

Range

N/A

info

String

Definition

SQL statement.

Range

N/A

state

String

Definition

Execution status.

Range

N/A

instance_id

String

Definition

Instance ID.

Range

The value contains 36 characters with a suffix of in07. Only letters and digits are allowed.

node_id

String

Definition

Node ID.

Range

The value contains 36 characters with a suffix of no07. Only letters and digits are allowed.

Status code: 400

Table 6 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

Status code: 500

Table 7 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

Example Request

GET https://{endpoint}/v3/054e292c9880d4992f02c0196d3ea468/instances/8d077700069043059acd78a52e54109din07/process/kill/history?start_time=1785665222033&end_time=1785924422033&page_num=1&page_size=10

Example Response

Status code: 200

{
  "total_count" : 1,
  "processes" : [ {
    "task_id" : "0",
    "session_id" : "4175629",
    "kill_time" : "1785814753",
    "mode" : "once",
    "user" : "testuser",
    "host" : "100.79.0.147:40620",
    "db" : "testdb",
    "command" : "Query",
    "time" : "15",
    "info" : "select sleep(600)",
    "state" : "User sleep",
    "instance_id" : "acb32c2d96cb476385cc4401ce66f1fdin07",
    "node_id" : "74c547079422484bbf1a6aba76100cb5no07"
  } ]
}

Status Code

For details, see Status Codes.

Error Code

For details, see Error Codes.