STV_SESSIONS - Amazon Redshift


Use the STV_SESSIONS table to view information about the active user sessions for Amazon Redshift.

To view session history, use the STL_SESSIONS table instead of STV_SESSIONS.

All rows in STV_SESSIONS, including rows generated by another user, are visible to all users.

Table columns

Column name Data type Description
starttime timestamp Time that the session started.
process integer Process ID for the session.
user_name character(50) User associated with the session.
db_name character(50) Name of the database associated with the session.

Sample queries

To perform a quick check to see if any other users are currently logged into Amazon Redshift, type the following query:

select count(*) from stv_sessions;

If the result is greater than one, then at least one other user is currently logged into the database.

To view all active sessions for Amazon Redshift, type the following query:

select * from stv_sessions;

The following result shows four active sessions currently running on Amazon Redshift:

starttime | process |user_name | db_name -------------------------+---------+----------------------------+--------- 2018-08-06 08:44:07.50 | 13779 | IAMA:aws_admin:admin_grp | dev 2008-08-06 08:54:20.50 | 19829 | dwuser | dev 2008-08-06 08:56:34.50 | 20279 | dwuser | dev 2008-08-06 08:55:00.50 | 19996 | dwuser | tickit (3 rows)

The user name prefixed with IAMA indicates that the user signed on using federated single sign-on (SSO). For more information, see Using IAM authentication to generate database user credentials.