STL_SESSIONS
Returns information about user session history.
STL_SESSIONS differs from STV_SESSIONS in that STL_SESSIONS contains session history, where STV_SESSIONS contains the current active sessions.
This table 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 the user who generated the entry. |
starttime | timestamp | Time in UTC that the session started. |
endtime | timestamp | Time in UTC that the session ended. |
process | integer | Process ID for the session. |
user_name | character(50) | User name associated with the session. |
db_name | character(50) | Name of the database associated with the session. |
Sample Queries
To view session history for the TICKIT database, type the following query:
select starttime, process, user_name from stl_sessions where db_name='tickit' order by starttime;
This query returns the following sample output:
starttime | process | user_name ---------------------------+---------+------------- 2008-09-15 09:54:06.746705 | 32358 | dwuser 2008-09-15 09:56:34.30275 | 32744 | dwuser 2008-09-15 11:20:34.694837 | 14906 | dwuser 2008-09-15 11:22:16.749818 | 15148 | dwuser 2008-09-15 14:32:44.66112 | 14031 | dwuser 2008-09-15 14:56:30.22161 | 18380 | dwuser 2008-09-15 15:28:32.509354 | 24344 | dwuser 2008-09-15 16:01:00.557326 | 30153 | dwuser 2008-09-15 17:28:21.419858 | 12805 | dwuser 2008-09-15 20:58:37.601937 | 14951 | dwuser 2008-09-16 11:12:30.960564 | 27437 | dwuser 2008-09-16 14:11:37.639092 | 23790 | dwuser 2008-09-16 15:13:46.02195 | 1355 | dwuser 2008-09-16 15:22:36.515106 | 2878 | dwuser 2008-09-16 15:44:39.194579 | 6470 | dwuser 2008-09-16 16:50:27.02138 | 17254 | dwuser 2008-09-17 12:05:02.157208 | 8439 | dwuser (17 rows)