SYS_SESSION_HISTORY - Amazon Redshift
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

SYS_SESSION_HISTORY

Use the SYS_SESSION_HISTORY to view information about the current active sessions and session history.

SYS_SESSION_HISTORY 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
user_id char(50) The identifier of the user who generated the entry.
session_id integer The ID of the session associated with the statement.
database_name char(50) The name of the database.
status char The status of the session. Possible values are active, timed out, and closed.
session_timeout integer The maximum time in seconds that a session remains inactive or idle before timing out. 0 indicates that no timeout is set.
start_time timestamp The timestamp that the connection was established.
end_time timestamp The timestamp that the connected stopped.

Example

The following is a sample output of SYS_SESSION_HISTORY.

select * from sys_session_history; user_id | session_id | database_name | status | session_timeout | start_time | end_time ---------+------------+------------------+--------+-----------------+----------------------------+---------------------------- 1 | 1073971370 | dev | closed | 0 | 2023-07-17 15:50:12.030104 | 2023-07-17 15:50:12.123218 1 | 1073979694 | dev | closed | 0 | 2023-07-17 15:50:24.117947 | 2023-07-17 15:50:24.131859 1 | 1073873049 | dev | closed | 0 | 2023-07-17 15:49:29.067398 | 2023-07-17 15:49:29.070294 1 | 1073873086 | database18127a4a | closed | 0 | 2023-07-17 15:49:29.119018 | 2023-07-17 15:49:29.125925 1 | 1073832112 | dev | closed | 0 | 2023-07-17 15:49:29.164688 | 2023-07-17 15:49:29.179631 1 | 1073987697 | dev | closed | 0 | 2023-07-17 15:49:29.26749 | 2023-07-17 15:49:29.273034 1 | 1073922429 | dev | closed | 0 | 2023-07-17 15:49:33.35315 | 2023-07-17 15:49:33.367499 1 | 1073766783 | dev | closed | 0 | 2023-07-17 15:49:45.38237 | 2023-07-17 15:49:45.396902 1 | 1073807506 | dev | active | 0 | 2023-07-17 15:51:48 |