Amazon Redshift
Database Developer Guide (API Version 2012-12-01)


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.

This view 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.

Table Rows

Row 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.
dimension varchar(24) Dimension on which the metric is reported. Possible values are query, segment, 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 -1, metrics segment values are rolled up to the query level.
step integer ID for the type of step that executed. The description for the step type is shown in the step_label column. .
step_label varchar(30) Type of step that executed.
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.
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.

On this page: