All Products
Search
Document Center

Hologres:HG_STAT_ACTIVITY (PG_STAT_ACTIVITY) view

Last Updated:Jul 07, 2025

In Hologres V2.0 and later, the PG_STAT_ACTIVITY view is upgraded to the HG_STAT_ACTIVITY view. The HG_STAT_ACTIVITY view is an extension of the PG_STAT_ACTIVITY view. You can use the HG_STAT_ACTIVITY view to query more detailed runtime information about active SQL queries. For example, you can query the query ID, query engine, and resource consumption information. This helps you diagnose issues of active queries.

Query the HG_STAT_ACTIVITY (PG_STAT_ACTIVITY) view

You can execute the following statements to query the runtime information about SQL queries on a Hologres instance. You can also use other management tools that are compatible with PostgreSQL to query the runtime information about SQL queries based on the PG_STAT_ACTIVITY view.

--Recommended syntax for V2.0 and later
SELECT *  FROM HG_STAT_ACTIVITY;

-- Syntax for Hologres V1.3 and earlier
SELECT *  FROM PG_STAT_ACTIVITY;

The following table describes the fields in the HG_STAT_ACTIVITY view.

Field

Description

Supported by the HG_STAT_ACTIVITY view

Supported by the PG_STAT_ACTIVITY view

datid

The object identifier (OID) of the connected database at the Hologres backend.

Supported

Supported

datname

The name of the connected database at the Hologres backend.

Supported

Supported

pid

The ID of the process at the Hologres backend.

Supported

Supported

query_id

The ID of the current SQL statement. One SQL statement corresponds to one query_id.

Supported

Not supported

transaction_id

The ID of the transaction to which the current SQL statement belongs. A transaction may contain multiple SQL statements.

Supported

Not supported

usesysid

The system identifier of the user in the current active session.

Supported

Supported

usename

The username that is used to create the current connection.

Supported

Supported

application_name

The type of the application on the client.

Common application types:

  • Realtime Compute for Apache Flink (VVR version): {client_version}_ververica-connector-hologres.

  • Apache Flink: {client_version}_hologres-connector-flink.

  • DataWorks Data Integration that allows you to run batch synchronization tasks to read data from Hologres: datax_{jobId}.

  • DataWorks Data Integration that allows you to run batch synchronization tasks to write data to Hologres: {client_version}_datax_{jobId}.

  • DataWorks Data Integration that allows you to synchronize data from databases to Hologres in real time: {client_version}_streamx_{jobId}.

  • HoloWeb: holoweb.

  • MaxCompute that allows you to access Hologres by using external tables: MaxCompute.

  • Process of reading Hologres binary logs initiated by Holo Client: holo_client_replication. The query content is not displayed for tasks of this type.

For other applications, we recommend that you explicitly specify the application_name field in the connection string if the applications are connected to Hologres instances.

Supported

Supported

running_info

The status of an SQL query during the query execution process. The value is in the JSON format. This field contains the following subfields:

  • current_resource

    Serverless: This subfield is available only for queries that are executed by using serverless computing resources.

  • current_stage

    • stage_name<PARSE|OPTIMIZE|QUEUE|START|EXECUTE|FINISH>:

      • PARSE: The SQL query is being parsed.

        Note

        If an SQL query is in the PARSE state, the engine_type field is unavailable.

      • OPTIMIZE: An execution plan is being generated.

      • QUEUE: The SQL query is waiting for resources.

      • START: The SQL query starts to be executed.

      • EXECUTE: The SQL query is being executed.

      • FINISH: The SQL query is complete.

    • stage_duration_ms: the time elapsed from the start time of the current stage to the current time. Unit: milliseconds.

    • queue_time_ms: the queuing time in milliseconds. This subfield is available only for queries that are executed by using serverless computing resources.

    • serverless_allocated_cores: the number of compute units (CUs) of serverless computing resources that are requested. This subfield is available only for queries that are executed by using serverless computing resources.

    • serverless_allocated_workers: the number of workers of serverless computing resources that are requested. This subfield is available only for queries that are executed by using serverless computing resources.

  • engine_type: the execution engine that is used to process the current query.

    • {HQE}: the Hologres engine.

    • {HQE,PQE}: the PostgreSQL Query Engine (PQE).

    • {PG}: the system engine, which does not require much attention.

    • {SDK} or {FixedQE}: the fixed plan.

      Note

      In versions earlier than Hologres V2.2, the engine_type of fixed plan SQL statements is {SDK}. In Hologres V2.2 and later, the engine_type of fixed plan SQL statements is changed from {SDK} to {FixedQE}.

    • {HQE,SQE}: the engine that is used to process SQL queries on MaxCompute foreign tables when the direct read feature is disabled.

    • {HQE,HiveQE}: the engine that is used to process SQL queries on Object Storage Service (OSS) foreign tables when the direct read feature is disabled.

    • {HQE,SQE,HiveQE}: the engine that is used to process SQL queries on foreign tables when the direct read feature is disabled.

  • fe_id: the ID of the FE node.

  • warehouse_id: the ID of the virtual warehouse if a virtual warehouse instance is used.

Supported

Not supported

extend_info

Extended information such as the resource consumption during the SQL query execution. The value is in the JSON format. This field contains the following subfields:

  • total_cpu_max_time_ms: the cumulative duration of CPU consumption of the SQL query. Unit: milliseconds.

  • total_mem_max_bytes: the sum of the maximum memory value of each operator in the SQL query. Unit: bytes.

  • scanned_rows: the total number of rows that have been read by the SQL query.

  • affected_rows: the number of rows on which the data manipulation language (DML) statement is performed.

  • be_lock_waiters: the ID of the SQL query that is waiting for the current SQL query to release the lock. The current SQL query is holding the lock.

Note

The be_lock_waiters subfield is valid for the backend lock, not the frontend lock. For more information about how to troubleshoot lock issues, see Locks and lock troubleshooting.

Supported

Not supported

state

The status of the connection. Valid values:

  • active: The connection is active.

  • idle: The connection is idle.

  • idle in transaction: The connection is idle in a long-running transaction.

  • idle in transaction (Aborted): The connection is idle in a failed transaction.

  • \N: This value indicates that the process is not a user connection process. In most cases, this state is returned for a maintenance process at the system backend and can be ignored.

Supported

Supported

query_start

The time when the SQL query starts to be executed. If the value of state for the current SQL query is not active, the start time of the previous SQL query is used.

Supported

Supported

client_addr

The IP address of the client.

The displayed IP address may have been resolved and may not be the actual IP address of the client.

Supported

Supported

client_hostname

The hostname of the client.

Supported

Supported

client_port

The port number of the client.

Supported

Supported

backend_start

The start time of the backend process.

You do not need to pay much attention to this field of Hologres.

Supported

Supported

xact_start

The start time of the current transaction of the process.

  • If no transactions are active, an empty string is returned.

  • If the current query is in the first transaction of the process, the value of this field is the same as the value of the query_start field.

You do not need to pay much attention to this field of Hologres.

Supported

Supported

state_change

The time when the state of the connection was last changed.

You do not need to pay much attention to this field of Hologres.

Supported

Supported

wait_event_type

The type of the event for which the backend is waiting for. If the backend is waiting for no event, the value of this field is NULL. Valid values:

  • LWLock: The backend is waiting for a lightweight lock to be released.

  • Lock: The backend is waiting for a heavyweight lock to be released. The wait_event field indicates the type of the lock for which the backend is waiting.

  • BufferPin: The server process is waiting to access a data buffer, and no other process is checking the data buffer.

  • Activity: The server process is idle. This value is returned for a system process that is waiting to be run in the main processing loop.

  • Extension: The server process is in an extension module and is waiting to be run.

  • Client: The server process is waiting for a query from a user application. In addition, the server is expecting an activity that is unrelated to its internal processing to happen.

  • PC: The server process is waiting for an activity of another process on the server.

  • Timeout: The server process is waiting for a timeout.

  • IO: The server process is waiting for the completion of an I/O operation.

Supported

Supported

wait_event

The name of the event for which the backend is waiting. If the backend is waiting for no event, the value of this field is NULL.

Supported

Supported

backend_xid

The identifier of the top-level transaction at the Hologres backend.

Supported

Supported

backend_xmin

The xmin scope at the backend.

Supported

Supported

query

The last query that was run at the backend. If the value of the state field is active, the query that is being run is displayed. If the state field is set to a value other than active, the last query is displayed.

Supported

Supported

backend_type

The type of the backend. Supported types include autovacuum launcher, autovacuum worker, logical replication launcher, logical replication worker, parallel worker, background writer, client backend, checkpointer, startup, walreceiver, walsender, and walwriter. Backend execution components such as PQE are also supported.

Note

Take note of the client backend type. This type indicates the type of the application connection.

Supported

Supported