pg_stat_activity_global
pg_stat_activity_global#
The pg_stat_activity_global system view provides information of the queries runing in the cluster.
Table 1. pg_catalog.pg_stat_activity_global
column  | 
type  | 
references  | 
description  | 
|---|---|---|---|
  | 
oid  | 
pg_database.oid  | 
Database OID  | 
  | 
name  | 
Database name  | 
|
  | 
text  | 
IP address of the main node  | 
|
  | 
integer  | 
Thread ID of this backend  | 
|
  | 
integer  | 
Session ID  | 
|
  | 
oid  | 
pg_authid.oid  | 
OID of the user logged into this backend  | 
  | 
name  | 
Name of the user logged into this backend  | 
|
  | 
text  | 
Name of the application that is connected to this backend  | 
|
  | 
inet  | 
IP address of the client connected to this backend. If this field is null, it 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.  | 
|
  | 
text  | 
Host name of the connected client, as reported by a reverse DNS lookup of client_addr. This field will only be non-null for IP connections, and only when log_hostname is enabled.  | 
|
  | 
integer  | 
TCP port number that the client is using for communication with this backend, or -1 if a Unix socket is used  | 
|
  | 
timestamp with time zone  | 
Time backend process was started  | 
|
  | 
timestamp with time zone  | 
Transaction start time  | 
|
  | 
timestamp with time zone  | 
Time query began execution  | 
|
  | 
timestamp with time zone  | 
Time when the state was last changed  | 
|
  | 
text  | 
Type of event for which the backend is waiting  | 
|
  | 
text  | 
Wait event name if backend is currently waiting  | 
|
  | 
text  | 
Current overall state of this backend. Possible values are:  | 
|
  | 
xid  | 
The top-level transaction identifier of this backend, if any.  | 
|
  | 
xid  | 
The current backend’s xmin horizon.  | 
|
  | 
text  | 
Text of this backend’s most recent query. If state is active this field shows the currently running query. In all other states, it shows the last query that was run.  | 
|
  | 
text  | 
The type of the current backend.  | 
|
  | 
integer  | 
Resource group OID or 0.  | 
|
  | 
text  | 
Resource group name or unknown.  |