GLOBAL_SESSION_STAT_ACTIVITY
GLOBAL_SESSION_STAT_ACTIVITY displays information about threads that are running on each node in openGauss.
Table 1 GLOBAL_SESSION_STAT_ACTIVITY columns
Name | Type | Description |
---|
coorname | text | Database process name |
datid | oid | OID of the database that the user session connects to in the backend |
datname | text | Name of the database that the user session connects to in the backend |
pid | bigint | Thread ID of the backend |
usesysid | oid | OID of the user logged in to the backend |
usename | text | Name of the user logged in to the backend |
application_name | text | Name of the application connected to the backend |
client_addr | inet | IP address of the client connected to the backend. If this column is null, it indicates either the client is connected via a Unix socket on the server or this is an internal process, such as autovacuum. |
client_hostname | text | Host name of the connected client, as reported by a reverse DNS lookup of client_addr. This column will be non-null only for IP connections and only when log_hostname is enabled. |
client_port | integer | TCP port number that the client uses for communication with this backend (-1 if a Unix socket is used) |
backend_start | timestampwith time zone | Time when this process was started, that is, when the client connected to the server |
xact_start | timestampwith time zone | Time when current transaction was started (null if no transaction is active). If the current query is the first of its transaction, the value of this column is the same as that of the query_start column. |
query_start | timestampwith time zone | Time when the currently active query was started, or time when the last query was started if state is not active |
state_change | timestampwith time zone | Time when the state was last changed |
waiting | boolean | Whether the backend is currently waiting on a lock. If yes, the value is true. |
enqueue | text | Unsupported currently |
state | text | Overall status of this backend. The value must be one of the following: - active: The backend is executing a query.
- idle: The backend is waiting for a new client command.
- idle in transaction: The backend is in a transaction, but is not currently executing a query.
- idle in transaction (aborted): This state is similar to idle in transaction, except that one of the statements in the transaction caused an error.
- fastpath function call: The backend is executing a fast-path function.
- disabled: This state is reported if track_activities is disabled in this backend.
NOTE:Common users can view their own session status only. The state information of other accounts is empty. For example, after the judy user is connected to the database, the state information of the joe user and the initial user omm in pg_stat_activity is empty. openGauss=# SELECT datname, usename, usesysid,state,pid FROM pg_stat_activity;
datname | usename | usesysid | state | pid
----------+---------+----------+--------+-----------------postgres | omm | 10 | |139968752121616
postgres | omm | 10 | |139968903116560
db_tpcds | judy | 16398 | active |139968391403280
postgres | omm | 10 | |139968643069712
postgres | omm | 10 | |139968680818448
postgres | joe | 16390 | |139968563377936
(6 rows)
|
resource_pool | name | Resource pool used by the user |
query_id | bigint | ID of a query |
query | text | Latest query at the backend. If state is active, this column shows the ongoing query. In all other states, it shows the last query that was executed. |
unique_sql_id | bigint | Unique SQL statement ID. |
trace_id | text | Driver-specific trace ID, which is associated with an application request. |
openGauss 2025-04-27 07:52:57