SVL_QUERY_METRICS - Amazon Redshift

SVL_QUERY_METRICS

The SVL_QUERY_METRICS view shows the metrics for completed queries. This view is derived from the STL_QUERY_METRICS system table. Use the values in this view as an aid to determine threshold values for defining query monitoring rules. For more information, see WLM query monitoring rules.

SVL_QUERY_METRICS is visible to all users. Superusers can see all rows; regular users can see only their own data. For more information, see Visibility of data in system tables and views.

Some or all of the data in this table can also be found in the SYS monitoring view SYS_QUERY_DETAIL. The data in the SYS monitoring view is formatted to be easier to use and understand. We recommend that you use the SYS monitoring view for your queries.

Table columns

Column name Data type Description
userid integer ID of the user that ran the query that generated the entry.
query integer Query ID. The query column can be used to join other system tables and views.
service_class integer ID for the WLM query queue (service class). Query queues are defined in the WLM configuration. Metrics are reported only for user-defined queues. For a list of service class IDs, see WLM service class IDs.
dimension varchar(24) Dimension on which the metric is reported. Possible values are query, segment, and step.
segment integer Segment number. A query consists of multiple segments, and each segment consists of one or more steps. Query segments can run in parallel. Each segment runs in a single process. If the segment value is 0, metrics segment values are rolled up to the query level.
step integer ID for the type of step performed. The description for the step type is shown in the step_label column. .
step_label varchar(30) Type of step performed.
query_cpu_time bigint CPU time used by the query, in seconds. CPU time is distinct from query run time.
query_blocks_read bigint Number of 1 MB blocks read by the query.
query_execution_time bigint Elapsed execution time for a query, in seconds. Execution time doesn’t include time spent waiting in a queue. See query_queue_time for the time queued.
query_cpu_usage_percent bigint Percent of CPU capacity used by the query.
query_temp_blocks_to_disk bigint The amount of disk space used by a query to write intermediate results, in MB.
segment_execution_time bigint Elapsed execution time for a single segment, in seconds.
cpu_skew numeric(38,2) The ratio of maximum CPU usage for any slice to average CPU usage for all slices. This metric is defined at the segment level.
io_skew numeric(38,2) The ratio of maximum blocks read (I/O) for any slice to average blocks read for all slices.
scan_row_count bigint The number of rows in a scan step. The row count is the total number of rows emitted before filtering rows marked for deletion (ghost rows) and before applying user-defined query filters.
join_row_count bigint The number of rows processed in a join step.
nested_loop_join_row_count bigint The number of rows in a nested loop join.
return_row_count bigint The number of rows returned by the query.
spectrum_scan_row_count bigint The number of rows scanned by Amazon Redshift Spectrum in Amazon S3.
spectrum_scan_size_mb bigint The amount of data, in MB, scanned by Amazon Redshift Spectrum in Amazon S3.
query_queue_time bigint The amount of time in seconds that the query was queued.