Updated on 2026-08-25 GMT+08:00

Querying Instance Sessions

Function

This API is used to query instance sessions.

Authorization Information

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

  • If you are using role/policy-based authorization, see the required permissions in Permissions Policies and Supported Actions.
  • 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

    Dependencies

    das:clouddba:listProcess

    list

    Instance

    -

    -

    -

URI

GET /v3/{project_id}/connections/{connection_id}/instance/query-process-list

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 can contain 32 characters. Only letters and digits are supported.

Default Value

N/A

connection_id

Yes

String

Definition

Connection ID established between a database account and the database. The database user ID is created using the API in Creating an Instance Connection.

Constraints

N/A

Range

The value is a UUID containing 36 characters. Only letters, digits, and hyphens (-) are allowed.

Default Value

N/A

Table 2 Query parameters

Parameter

Mandatory

Type

Description

user

No

String

Definition

Specified user

Constraints

N/A

Range

N/A

Default Value

N/A

host

No

String

Definition

Specified access source

Constraints

N/A

Range

N/A

Default Value

N/A

db

No

String

Definition

Specified database

Constraints

N/A

Range

N/A

Default Value

N/A

state

No

String

Definition

Specified status

Constraints

N/A

Range

N/A

Default Value

N/A

command

No

String

Definition

Specified command

Constraints

N/A

Range

N/A

Default Value

N/A

keywords

No

String

Definition

Fuzzy search criteria

Constraints

N/A

Range

N/A

Default Value

N/A

show_all

No

Boolean

Definition

Whether to show all

Constraints

N/A

Range

N/A

Default Value

false

show_no_pid

No

Boolean

Definition

Whether to display sessions without background processes

Constraints

N/A

Range

N/A

Default Value

false

time

No

String

Definition

Threshold for slow SQL statements

Constraints

N/A

Range

N/A

Default Value

0

per_page

No

String

Definition

Number of records on each page

Constraints

N/A

Range

[0, 100]. The actual value depends on the query result.

Default Value

N/A

cur_page

No

String

Definition

Page number

Constraints

N/A

Range

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

Default Value

N/A

order_by

No

String

Definition

Columns to be sorted

Constraints

N/A

Range

N/A

Default Value

time

order

No

String

Definition

Sorting order

Constraints

N/A

Range

  • asc: ascending order
  • desc: descending order

Default Value

desc

node_id

No

String

Definition

Unique ID of a node. You can obtain the node ID from the node list in the instance details.

Constraints

N/A

Range

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

Default Value

N/A

node_role

No

String

Definition

Node type

Constraints

N/A

Range

  • master: primary node
  • slave: secondary node
  • readreplica: read replica

Default Value

N/A

hide_sys

No

Boolean

Definition

Whether to filter system sessions

Constraints

N/A

Range

true: The sessions are to be filtered.

false: The sessions are not to be filtered.

Default Value

false

Request Parameters

None

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

process_info_list

Array of Table 4 objects

Definition

Session information list

total

Long

Definition

Total number of sessions that meet the filter criteria

Range

N/A

user_info_list

Array of strings

Definition

User list

db_info_list

Array of strings

Definition

Database list

host_info_list

Array of strings

Definition

Source IP address list

state_info_list

Array of strings

Definition

Status list

command_info_list

Array of strings

Definition

Command list

session_exec_time

Map

Definition

Session execution time ratio

Range

N/A

idle_session

Long

Definition

Number of idle sessions

Range

N/A

active_session

Long

Definition

Number of running sessions

Range

N/A

summary

Array of Table 5 objects

Definition

Summary

user_stats

Array of Table 6 objects

Definition

Statistics by user

host_stats

Array of Table 6 objects

Definition

Statistics by access source

db_stats

Array of Table 6 objects

Definition

Statistics by database

show_version_support_message

Boolean

Definition

Whether to display the version support information

Range

N/A

show_warn_message

Boolean

Definition

Whether an alarm is generated

Range

N/A

Table 4 ProcessInfo

Parameter

Type

Description

id

String

Definition

Session ID

Range

N/A

user

String

Definition

User

Range

N/A

host

String

Definition

IP address and port number for connecting to a database

Range

N/A

db

String

Definition

Database

Range

N/A

command

String

Definition

Command that is being executed

Range

N/A

time

String

Definition

Session running time

Range

N/A

state

String

Definition

Execution status

Range

N/A

info

String

Definition

Executed SQL statement

Range

N/A

trx_duration

String

Definition

Transaction duration

Range

N/A

Table 5 ProcessSummary

Parameter

Type

Description

key

String

Definition

Summary parameter name

Range

N/A

value

Long

Definition

Summary parameter value

Range

N/A

Table 6 ProcessStats

Parameter

Type

Description

key

String

Definition

Statistical item name

Range

N/A

value

String

Definition

Statistical item value

Range

N/A

active_count

Long

Definition

Number of active sessions

Range

N/A

total_count

Long

Definition

Total number

Range

N/A

Example Requests

GET https://das.cn-north-1.myhuaweicloud.com/v3/054e292c9880d4992f02c0196d3ea468/connections/179e525e-0e9c-4dcc-9dd7-ee2f36121e23/instance/query-process-list?cur_page=1&per_page=10&show_all=true&order_by=time&order=desc&keywords=&show_no_pid=false&hide_sys=true&db=&user=&host=&state=

Example Responses

Status code: 200

Success.

{
    "process_info_list": [
        {
            "id": "6453001",
            "user": "root",
            "host": "100.79.0.248:41926",
            "db": "--",
            "command": "Sleep",
            "time": "38",
            "state": "",
            "info": "",
            "trx_duration": "0"
        }
    ],
    "total": 1,
    "show_version_support_message": true,
    "show_warn_message": false,
    "user_info_list": [
        "root"
    ],
    "db_info_list": [
        "--"
    ],
    "host_info_list": [
        "100.xx.xx.xx"
    ],
    "state_info_list": [],
    "command_info_list": [
        "Sleep",
        "Query"
    ],
    "session_exec_time": {
        "less500ms": 0,
        "more60s": 0,
        "less60s": 1,
        "less100ms": 0,
        "less5s": 0,
        "less1s": 0
    },
    "idle_session": 1,
    "active_session": 0,
    "summary": [
        {
            "key": "totalSession",
            "value": 1
        },
        {
            "key": "activeSession",
            "value": 0
        },
        {
            "key": "maxActiveSessionTime",
            "value": 38
        }
    ],
    "user_stats": [
        {
            "key": "user",
            "value": "root",
            "active_count": 0,
            "total_count": 1
        }
    ],
    "host_stats": [
        {
            "key": "host",
            "value": "100.79.0.248",
            "active_count": 0,
            "total_count": 1
        }
    ],
    "db_stats": [
        {
            "key": "db",
            "value": "--",
            "active_count": 0,
            "total_count": 1
        }
    ]
}

Status Codes

Status Code

Description

200

Success.

400

Client error.

500

Server error.

Error Codes

See Error Codes.