Skip to content

metering.vcpu_estimate_per_query

The metering.vcpu_estimate_per_query view contains information about the queries that use the most vCPU on the system. On every metering execution, the top 100 queries based on maximum execution time (run_ms) will get loaded and stored in this view.

The vcpu_estimate_seconds is calculated by using the formula:

vcpu_estimate_seconds = (run_mswait_run_cpu_ms) x No. of workers x cores per worker

  • run_ms: Time required for query to get executed. It tells us how long the query was running on the longest-running worker node. This value represents the total time the query spent in the run state.

  • wait_run_cpu_ms: Duration needed for processing the query.

Note: The value (run_mswait_run_cpu_ms) is rounded up.

The run_ms value is NULL before the query enters the run state, then it is initialized to 0.

This view can be used to understand if the cluster capacity is properly utilised.

Column NameData TypeDescriptionExample
datetime_startTIMESTAMPTZThe time the query submitted. Maps to submit_time in sys.log_query.2023-12-19T06:56:56.842390Z
query_idBIGINTThe id of the query that ran. Maps to query_id of sys.log_query.247202
query_textVARCHARThe first 10000 characters of the query text that ran. This is truncated to keep the table small.ANALYZE HLL test_schema3.table2_1000_col_100000_rows
usernameVARCHARThe user running the query.testuser@yellowbrick.com
cluster_nameVARCHARName of the cluster the query ran on.default_cluster
cluster_idUUIDId of the cluster the query ran on.fb96868a-cbea-422a-99b4-af485e9b43a9
ipVARCHARIP number of the user running the query.49.248.77.119
hostnameVARCHARHostname (if available) of the user running the query.
application_nameVARCHARApplication name, as set by SET application_name for the application that ran the query.ym
vcpu_estimate_secondsINTEGEREstimated number of vcpu_seconds the query needed on the cluster to run. This value takes into account concurrency and only measures the time the query actually used the scheduler.17968