All Products
Search
Document Center

Hologres:Monitor serverless computing tasks

Last Updated:Mar 26, 2026

Use the queries and metrics in this topic to monitor Hologres Serverless Computing — check which tasks are running or queued, investigate historical task logs, and view total resource consumption across your databases.

View monitoring metrics

Log in to the Hologres console to view Serverless Computing metrics for your instance. For more information, see Instance observability with CloudMonitor.

View task status

Query the hg_stat_activity view to see tasks currently running or queued on serverless resources.

Task execution stages

StageDescription
EXECUTETask is actively running on serverless resources
QUEUETask is waiting for serverless resources to become available

View running tasks

SELECT
    *,
    (running_info::json) ->> 'computing_resource' AS computing_resource,
    (running_info::json) ->> 'current_stage' AS current_stage
FROM
    hg_stat_activity
WHERE (running_info::json) ->> 'computing_resource' = 'Serverless'
    AND (running_info::json) -> 'current_stage'->>'stage_name' = 'EXECUTE'

View queued tasks

SELECT
    *,
    (running_info::json) ->> 'computing_resource' AS computing_resource,
    (running_info::json) ->> 'current_stage' AS current_stage
FROM
    hg_stat_activity
WHERE (running_info::json) ->> 'computing_resource' = 'Serverless'
    AND (running_info::json) -> 'current_stage'->>'stage_name' = 'QUEUE'

View a specific task

Replace <query_id> with the ID of the task you want to look up.

SELECT
    *,
    (running_info::json) ->> 'computing_resource' AS computing_resource,
    (running_info::json) ->> 'current_stage' AS current_stage
FROM
    hg_stat_activity
WHERE
    query_id = '<query_id>';

Query historical tasks

Data in hologres.hg_query_log and hologres.hg_serverless_computing_query_log is retained for one month.

Starting from Hologres V2.1.18, use the hologres.hg_serverless_computing_query_log view to query tasks that ran on serverless resources.

SELECT
    *
FROM
    hologres.hg_serverless_computing_query_log;

Additional fields vs. slow query logs

This view adds the following fields on top of what slow query logs provide:

FieldDescription
queue_time_msTime (ms) the query spent waiting for serverless resources
serverless_allocated_coresNumber of CUs allocated to the query
serverless_allocated_workersNumber of workers allocated to the query
serverless_resource_used_time_msTime (ms) the query actively used serverless resources

Query origin: serverless_computing_source

The extended_info field includes a serverless_computing_source value that identifies how a query ended up on serverless resources:

ValueDescription
user_submitQuery explicitly submitted by the user for serverless execution
query_queueQuery originated from a query queue configured for serverless execution. See Run query queue queries using Serverless Computing resources.
big_query_isolation_serviceQuery used serverless resources via Adaptive Serverless Computing. See Adaptive serverless computing.
query_queue_rerunLarge query automatically re-executed on serverless resources. See Large query management.

When serverless_computing_source is query_queue_rerun, the query_id_of_triggered_rerun field contains the original query ID of the re-executed query.

Version behavior

  • Before V2.2.7: the view includes only successful queries with an execution duration greater than 100 ms, and all failed queries.

  • V2.2.7 and later: the view includes all queries that ran on Serverless Computing.

Link multi-record tasks to their original SQL

Tasks such as COPY, CTAS, and INSERT OVERWRITE generate multiple records in slow query logs: one for the original SQL and additional records for the INSERT statements created during execution. The INSERT records are the ones that actually consume serverless resources.

To link INSERT records back to the original task, use the trans_id from the original task's record as the source_trx filter:

SELECT
    query_id,
    query,
    extended_info
FROM
    hologres.hg_query_log
WHERE
    extended_info ->> 'source_trx' = '<transaction_id>' -- Obtain the transaction_id from the trans_id field of the record for tasks like COPY, CTAS, or RESHARDING.
    -- extended_info ->> 'src_query_id' = 'query_id'	-- Stored procedures are not transactions, so you need to link them using the query_id field.
    -- query like '%<transaction_id>%'	-- RESHARDING tasks cannot be linked using the extended_info field. You must link them using the query field.
ORDER BY
    query_start
;

View resource usage

Query total serverless CU consumption across all active tasks, grouped by database and execution stage:

SELECT
    datname::text as db_name,
    (running_info::json) -> 'current_stage' ->> 'stage_name' AS current_stage,
    SUM(((running_info::json) -> 'current_stage' ->> 'serverless_allocated_cores')::int) AS total_computing_resource,
    count(1) as query_qty
FROM
    hg_stat_activity
WHERE (running_info::json) ->> 'computing_resource' = 'Serverless'
GROUP BY
    1,
    2;

The result set includes the following columns:

ColumnDescription
db_nameDatabase name
current_stageExecution stage: EXECUTE (running) or QUEUE (queued)
total_computing_resourceTotal CUs consumed by queries in this database and stage
query_qtyNumber of SQL queries