Appearance
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_secondsis calculated by using the formula:
vcpu_estimate_seconds= (run_ms–wait_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_ms–wait_run_cpu_ms) is rounded up.The
run_msvalue is NULL before the query enters therunstate, then it is initialized to 0.
This view can be used to understand if the cluster capacity is properly utilised.
| Column Name | Data Type | Description | Example |
|---|---|---|---|
datetime_start | TIMESTAMPTZ | The time the query submitted. Maps to submit_time in sys.log_query. | 2023-12-19T06:56:56.842390Z |
query_id | BIGINT | The id of the query that ran. Maps to query_id of sys.log_query. | 247202 |
query_text | VARCHAR | The 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 |
username | VARCHAR | The user running the query. | testuser@yellowbrick.com |
cluster_name | VARCHAR | Name of the cluster the query ran on. | default_cluster |
cluster_id | UUID | Id of the cluster the query ran on. | fb96868a-cbea-422a-99b4-af485e9b43a9 |
ip | VARCHAR | IP number of the user running the query. | 49.248.77.119 |
hostname | VARCHAR | Hostname (if available) of the user running the query. | |
application_name | VARCHAR | Application name, as set by SET application_name for the application that ran the query. | ym |
vcpu_estimate_seconds | INTEGER | Estimated 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 |