Description
Shows information about sessions in the session connection pool.
Privilege requirements
Only root@sys and root@proxysys may run this statement. root@sys can view sessions for all tenants in the current cluster. root@proxysys can view sessions across all clusters and tenants.
Syntax
SHOW GLOBALSESSION [ATTRIBUTE [all | 'db_key']]
Parameters
Parameter |
Description |
|---|---|
| SHOW GLOBALSESSION | Shows session pool statistics. |
| ATTRIBUTE | Optional; shows detailed pooled session rows. |
| [all | 'db_key'] | Optional. all lists all tenants; db_key is cluster_name:tenant_name for one tenant. |
Examples
Pool statistics:
SHOW GLOBALSESSION;Example: two cached sessions for tenant
test:+-----------------+------------+---------------+ | dbkey_name | idle_count | idle_timeout | +-----------------+------------+---------------+ | obcluster:sys | 0 | 1800000000000 | | obcluster:test | 2 | 1800000000000 | +-----------------+------------+---------------+Detailed sessions for one tenant:
SHOW GLOBALSESSION ATTRIBUTE 'obcluster:test'\G*************************** 1. row *************************** dbkey_name: obcluster:test auth_user: admin@test#obcluster server_ip: 10.10.10.1:25706 local_ip: 10.10.10.2:35950 session_state: KEEP_ALIVE_GLOBAL_SHARED server_session_id: 3222004961 ss_id: 193 create_time: 2025-04-08 16:55:26.458191 last_release_time: 2025-04-08 16:55:38.803114 timeout_time: 2025-04-08 17:25:38.803114 *************************** 2. row *************************** dbkey_name: obcluster:test auth_user: admin@test#obcluster server_ip: 10.10.10.1:25704 local_ip: 10.10.10.2:33250 session_state: KEEP_ALIVE_GLOBAL_SHARED server_session_id: 3221679414 ss_id: 43 create_time: 2025-04-08 16:41:00.410908 last_release_time: 2025-04-08 16:55:38.803067 timeout_time: 2025-04-08 17:25:38.803067
Output columns
SHOW GLOBALSESSION:
Column |
Meaning |
|---|---|
| dbkey_name | Tenant in the form cluster_name:tenant_name. |
| idle_count | Number of pooled sessions for the tenant. |
| idle_timeout | Maximum idle time a session may stay in the pool (nanoseconds), controlled by session_pool_idle_timeout. |
SHOW GLOBALSESSION ATTRIBUTE:
Column |
Meaning |
|---|---|
| dbkey_name | Tenant: cluster_name:tenant_name. |
| auth_user | Login user: user@tenant#cluster. |
| server_ip | OBServer endpoint for the session. |
| local_ip | ODP endpoint for the session. |
| session_state | Session state; currently only KEEP_ALIVE_GLOBAL_SHARED. |
| server_session_id | Session ID on OceanBase Database. |
| ss_id | Session ID used by ODP. |
| create_time | Session creation time. |
| last_release_time | Last time the session was returned to the pool. |
| timeout_time | Expiration time; expired sessions are removed from the pool. |
