STL_SESSIONS - Amazon Redshift

本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。

STL_SESSIONS

傳回使用者工作階段歷史記錄的相關資訊。

STL_ SESSIONS 與 _ 不同之處SESSIONS在於 STV STL _ SESSIONS 包含工作階段歷史記錄,其中 STV _ SESSIONS 包含目前的作用中工作階段。

STL_ SESSIONS 對所有用戶都可以看到。超級使用者可以看見所有資料列;一般使用者只能看見自己的資料。如需詳細資訊,請參閱系統資料表和檢視中資料的可見性

此表格中的部分或全部資料也可以在SYS監視檢視中找到SYS_SESSION_HISTORY。SYS監視檢視中的資料格式化為更易於使用和理解。我們建議您使用SYS監視視圖進行查詢。

資料表欄

欄名稱 資料類型 描述
userid integer 產生項目的使用者之 ID。
starttime timestamp 階段作業開始的時間。UTC
endtime timestamp 工作階段UTC結束的時間。
process integer 工作階段的處理程序 ID。
user_name character(50) 與工作階段相關聯的使用者名稱。
db_name character(50) 與工作階段相關聯之資料庫的名稱。
timeout_sec int 逾時前,工作階段保持非作用中或閒置的時間上限 (以秒為單位)。0 表示未設定逾時。
timed_out int

指出終止連線的原因的值。它可以具有以下值:

  • 0:由於未知錯誤,連接已終止。

  • 1:連線逾時。

  • 2:客戶端終止了連接。

  • 3:一個 Amazon Redshift 後端內部錯誤終止了連接。

範例查詢

若要檢視TICKIT資料庫的工作階段歷程記錄,請輸入下列查詢:

select starttime, process, user_name, timeout_sec, timed_out from stl_sessions where db_name='tickit' order by starttime;

此查詢傳回下列範例輸出:

starttime | process | user_name | timeout_sec | timed_out ---------------------------+---------+------------------------+-------------+------------- 2008-09-15 09:54:06.746705 | 32358 | dwuser | 120 | 1 2008-09-15 09:56:34.30275 | 32744 | dwuser | 60 | 1 2008-09-15 11:20:34.694837 | 14906 | dwuser | 0 | 0 2008-09-15 11:22:16.749818 | 15148 | dwuser | 0 | 0 2008-09-15 14:32:44.66112 | 14031 | dwuser | 0 | 0 2008-09-15 14:56:30.22161 | 18380 | dwuser | 0 | 0 2008-09-15 15:28:32.509354 | 24344 | dwuser | 0 | 0 2008-09-15 16:01:00.557326 | 30153 | dwuser | 120 | 1 2008-09-15 17:28:21.419858 | 12805 | dwuser | 0 | 0 2008-09-15 20:58:37.601937 | 14951 | dwuser | 60 | 1 2008-09-16 11:12:30.960564 | 27437 | dwuser | 60 | 1 2008-09-16 14:11:37.639092 | 23790 | dwuser | 3600 | 1 2008-09-16 15:13:46.02195 | 1355 | dwuser | 120 | 1 2008-09-16 15:22:36.515106 | 2878 | dwuser | 120 | 1 2008-09-16 15:44:39.194579 | 6470 | dwuser | 120 | 1 2008-09-16 16:50:27.02138 | 17254 | dwuser | 120 | 1 2008-09-17 12:05:02.157208 | 8439 | dwuser | 3600 | 0 (17 rows)