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


Use the SVV_QUERY_INFLIGHT view to determine what queries are currently running on the database. This view joins STV_INFLIGHT to STL_QUERYTEXT. SVV_QUERY_INFLIGHT does not show leader-node only queries. For more information, see Leader Node–Only Functions.

SVV_QUERY_INFLIGHT 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 Columns

Column Name Data Type Description
userid integer ID of user who generated entry.
slice integer Slice where the query is running.
query integer Query ID. Can be used to join various other system tables and views.
pid integer Process ID. All of the queries in a session are run in the same process, so this value remains constant if you run a series of queries in the same session. You can use this column to join to the STL_ERROR table.
starttime timestamp Time that the query started.
suspended integer Whether the query is suspended: 0 = false; 1 = true.
text character(200) Query text, in 200-character increments.
sequence integer Sequence number for segments of query statements.

Sample Queries

The sample output below shows two queries currently running, the SVV_QUERY_INFLIGHT query itself and query 428, which is split into three rows in the table. (The starttime and statement columns are truncated in this sample output.)

select slice, query, pid, starttime, suspended, trim(text) as statement, sequence from svv_query_inflight order by query, sequence; slice|query| pid | starttime |suspended| statement | sequence -----+-----+------+----------------------+---------+-----------+--------- 1012 | 428 | 1658 | 2012-04-10 13:53:... | 0 | select ...| 0 1012 | 428 | 1658 | 2012-04-10 13:53:... | 0 | enueid ...| 1 1012 | 428 | 1658 | 2012-04-10 13:53:... | 0 | atname,...| 2 1012 | 429 | 1608 | 2012-04-10 13:53:... | 0 | select ...| 0 (4 rows)