how to query closed session in vertica

时间:2019-01-09 22:28:56

标签: sql database vertica

Is there a way to query closed session record in vertica database? It seem there is only a table store the current active sessions:

select * from sessions

1 个答案:

答案 0 :(得分:1)

您要查看dc_session_ends表。

SELECT * FROM dc_session_ends;

它显示了会话关闭的时间,会话所在的节点,session_id和user_id / user_name。

要对其进行测试,可以查询当前的session_id。

SELECT session_id FROM current_session;

如果使用该session_id查询dc_session_ends表,则不会显示任何内容,但是如果您关闭会话,然后重新连接,则会看到session_id出现。

SELECT * FROM dc_session_ends WHERE session_id = '<session_id>';