Starting in Hologres V2.0, the PG_STAT_ACTIVITY view is upgraded to HG_STAT_ACTIVITY. As an extension of the PG_STAT_ACTIVITY view, HG_STAT_ACTIVITY provides more detailed runtime information for an active SQL query, such as the query ID, query engine, and resource consumption. This information improves active query diagnostics.
If you are using an instance with virtual warehouses, this view shows active queries only for the virtual warehouse to which you are currently connected. You cannot query active queries in other virtual warehouses.
Querying the HG_STAT_ACTIVITY (PG_STAT_ACTIVITY) view
You can run the following commands to view query runtime information. PostgreSQL-compatible management tools can still query PG_STAT_ACTIVITY to obtain SQL runtime information.
-- Recommended for V2.0 and later
SELECT * FROM HG_STAT_ACTIVITY;
-- For V1.3 and earlier
SELECT * FROM PG_STAT_ACTIVITY;The following table describes the fields in the HG_STAT_ACTIVITY view.
Field | Description | HG_STAT_ACTIVITY support | PG_STAT_ACTIVITY support |
datid | The object identifier (OID) of the database to which the Hologres backend is connected. | Supported | Supported |
datname | The name of the database to which the Hologres backend is connected. | Supported | Supported |
pid | The process ID of the Hologres backend. | Supported | Supported |
query_id | A unique ID for the currently executing SQL query. | Supported | Not supported |
transaction_id | The ID of the transaction to which the current SQL query belongs. A transaction can contain multiple SQL queries. | Supported | Not supported |
usesysid | The system ID of the user in the current active session. | Supported | Supported |
usename | The username for the current connection. | Supported | Supported |
application_name | The name of the client application. Common application names include:
For other applications, we recommend that you explicitly specify the | Supported | Supported |
running_info | Contains information about the SQL execution process in JSON format. Subfields include:
| Supported | Not supported |
extend_info | Contains extended information about resource consumption during SQL execution in JSON format. Subfields include:
Note
| Supported | Not supported |
state | The state of the connection. Common states include:
| Supported | Supported |
query_start | The time when the query started. If the state is not | Supported | Supported |
client_addr | The IP address of the client. This may be a resolved address, not the original source IP address. | Supported | Supported |
client_hostname | The hostname of the client. | Supported | Supported |
client_port | The port of the client. | Supported | Supported |
backend_start | The time when the backend process started. This field is typically not relevant in Hologres. | Supported | Supported |
xact_start | The start time of the process's current transaction.
This field is typically not relevant in Hologres. | Supported | Supported |
state_change | The time when the connection state ( This field is typically not relevant in Hologres. | Supported | Supported |
wait_event_type | The type of event the backend is waiting for. NULL if not waiting. Possible values include:
| Supported | Supported |
wait_event | The name of the wait event, if the backend is waiting. NULL otherwise. | Supported | Supported |
backend_xid | The top-level transaction identifier of the Hologres backend. | Supported | Supported |
backend_xmin | The current backend's | Supported | Supported |
query | The text of the backend's most recent query. If the state is | Supported | Supported |
backend_type | The type of the current backend. Possible types are Note Pay attention to the | Supported | Supported |