Monday 14 August 2017

How to close or kill a session?



Using "CLOSE_SESSION" Or "INTERUPT_STATEMENT" commands, we can close/kill current running sessions.

Detailed Description:
If we need to close a session, follow the below steps

Step1: Identify the session
  • Find the Session Id which we need to close. Connect to Vertica DB Using super user and run the below query, it gives the list of current running sessions along with Session_Id.
          SELECT * FROM  SESSIONS

Step2: Close the session
  •  Using "Close_Session" or "Interupt_Statement" commands we can colse/kill the current running sessions.

Syntax:
          SELECT CLOSE_SESSION('<Session ID>')
          OR
          SELECT INTERUPT_STATEMENT('<Session ID>')

How to find currently running sessions?



Vertica is having a table 'Sessions' to maintain currently running sessions information. Using Sessions table we can find the current running sessions information.

Query: Connect to DB as Admin and run the below statement

SELECT * FROM SESSIONS