We're Moving!

The Vertica Forum is moving to a new OpenText Analytics Database (Vertica) Community.

Join us there to post discussion topics, learn about

product releases, share tips, access the blog, and much more.

Create My New Community Account Now


Function to close sessions by user — Vertica Forum

Function to close sessions by user

The function CLOSE_SESSION(session_id) closes a session based off a session. I'd like to request a function that can close all sessions based on a user name. For example, CLOSE_USER_SESSIONS(user_name) which would close sessions based on the user_name.

This is helpful when there's 500+ connections active from a user. Currently, I stage the close session statement from user_sessions.

Comments

  • Bit of a hack, but you could create a Java UDF transform function that takes a set of session ids as input, then inside the UDF connect back to Vertica with JDBC and call close_session on each session_id.

    For instance, select my_close_session(session_id) over() from sessions where user_name = 'biff';



  • Bit of a hack, but you could create a Java UDF transform function that takes a set of session ids as input, then inside the UDF connect back to Vertica with JDBC and call close_session on each session_id.

    For instance, select my_close_session(session_id) over() from sessions where user_name = 'biff';



  • or you can do something as simple as 

    vsql -At -c "select 'select close_session(''' || session_id || ''');' from sessions where user_name = '<user_name>';" | vsql

    that will create the statement and pipe it to a new vsql session to be executed. 

    Hope that makes sense. 

    Eugenia
  • While that's a simple work around, a function to handle it would certainly be nice.

  • I will open a feature request in our ticket system. Thanks,

    Eugenia

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file