Script to List Vertica Active Sessions

   This is Vertica script that will allow you to see all the session that are active in your Vertica Database.

   This is easy to use and will also prove you with a string to close the session, the name of the Column that caries the close session command is CloseSession.

 Use this script with care !!!

SELECT
     node_name
    ,user_name
    ,'SELECT CLOSE_SESSION(''' || session_id || ''');'  AS CloseSession
    ,statement_start
    ,(GETDATE() - statement_start)::INTERVAL  AS current_statement_duration
    ,REGEXP_REPLACE(current_statement,'[rnt]',' ') AS current_statement
    ,session_id
    ,transaction_id
    ,statement_id
    ,client_hostname
    ,client_os
    ,login_timestamp
    ,runtime_priority
    ,ssl_state
    ,authentication_method
    ,transaction_start
    ,GETDATE() AS Today
FROM v_monitor.sessions
ORDER BY current_statement_duration DESC
;