PGXC_STAT_ACTIVITY
PGXC_STAT_ACTIVITY displays the query information about the current user on all the CNs in the current cluster. Only the system administrator has the permission to query this view.
| Name | Type | Description |
|---|---|---|
| coorname | text | Name of the CN in the current cluster |
| datid | oid | OID of the database that the user session connects to in the backend |
| datname | name | Name of the database that the user session connects to in the backend |
| pid | bigint | ID of the backend thread |
| usesysid | oid | OID of the user logging in to the backend |
| usename | name | Name of the user logging 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 null indicates either that the client is connected via a Unix socket on the server machine or that 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 only be non-null when IP connections are used and log_hostname is enabled. |
| client_port | integer | TCP port number that the client uses for communication with this backend, or -1 if a Unix socket is used |
| backend_start | timestamp with time zone | Startup time of the backend process, that is, the time when the client connects to the server. |
| xact_start | timestamp with time zone | Time when the current transaction was started, or NULL if no transaction is active. If the current query is the first of its transaction, this column is equal to the query_start column. |
| query_start | timestamp with time zone | Time when the currently active query was started, or if state is not active, when the last query was started |
| state_change | timestamp with time zone | Time for the last status change |
| waiting | Boolean | Whether the backend is currently waiting on a lock. If it is, its value is true. |
| enqueue | text | Queuing status of a statement. Its value can be:
|
| state | text | Current overall state of this backend. Its value can be:
NOTE: Only system administrators can view the session status of their accounts. The state information of other accounts is empty. For example, after user judy is connected to the database, the state information of user joe and the initial user omm in pgxc_stat_activity is empty. SELECT datname, usename, usesysid, state,pid FROM pgxc_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 | Recent query of this backend. If state is active, this column shows the executing query. In all other states, it shows the last query that was executed. |
| connection_info | text | A string in JSON format recording the driver type, driver version, driver deployment path, and process owner of the connected database (for details, see connection_info) |
Last Article: PGXC_RUNNING_XACTS
Next Article: PGXC_STAT_BAD_BLOCK
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.