Closing idle sessions automatically

Moderator: NorbertKrupa

Post Reply
rajasekhart
Intermediate
Intermediate
Posts: 87
Joined: Wed Apr 25, 2012 8:10 am

Closing idle sessions automatically

Post by rajasekhart » Mon May 28, 2012 8:45 am

Hi,

I want to close the sessions (which were unused for a long time say 48 hours) automatically.
But i dont want to close them explicitly by writting Close_Session command.
Is it possible in vertica?
Please help me.

Thanks in advance,
Raj.
Rajasekhar.T|HP ATP Vertica Big Data Solutions V1

jpcavanaugh
Intermediate
Intermediate
Posts: 149
Joined: Mon Apr 30, 2012 10:04 pm
Location: New York
Contact:

Re: Closing idle sessions automatically

Post by jpcavanaugh » Mon May 28, 2012 5:02 pm

I do not believe this functionality exists in the current version but a simple cron script should be able to handle this for you.

id10t
GURU
GURU
Posts: 732
Joined: Mon Apr 16, 2012 2:44 pm

Re: Closing idle sessions automatically

Post by id10t » Mon May 28, 2012 6:28 pm

I agree with @juniorfoo. You can set max session duration, but i don't know about any feature with IDLE.

For current max session duration:

Code: Select all

dbadmin=> show runtimecap;
    name    |  setting  
------------+-----------
 runtimecap | UNLIMITED
(1 row)

billykopecki
Beginner
Beginner
Posts: 42
Joined: Thu Apr 19, 2012 9:03 pm

Re: Closing idle sessions automatically

Post by billykopecki » Wed Jun 13, 2012 12:52 pm

What do you guys think of this solution for closing idle sessions?

I created a shell script file containing the following commands:

Code: Select all

/opt/vertica/bin/vsql -U dbadmin -c "SELECT 'close_session(''' || session_id || ''');' FROM sessions s join users u on u.user_name = s.user_name WHERE s.login_timestamp <= timestampadd(minute, -45, sysdate) AND s.current_statement = '' AND u.is_super_user = 'f';" -o /home/usr/dbadmin/close_session.sql -t
/opt/vertica/bin/vsql -U dbadmin -f /root/vload/close_session.sql -o /home/usr/dbadmin/close_session.out
I run the script every 10 minutes as a cron job.

Anyone see any problems with this?

User avatar
fsalvelt
Intermediate
Intermediate
Posts: 54
Joined: Sun Mar 18, 2012 1:34 am

Re: Closing idle sessions automatically

Post by fsalvelt » Tue Jul 17, 2012 1:49 pm

billykopecki,

I need to also implement this functionality. Is what you did working ok? Another DBA told me that its a bad idea to close sessions without letting the user know first. Also, have you seen any performance problems with leaving idle session open?

Thanks!
Thank, Fred

rajasekhart
Intermediate
Intermediate
Posts: 87
Joined: Wed Apr 25, 2012 8:10 am

Re: Closing idle sessions automatically

Post by rajasekhart » Sat Jul 21, 2012 10:33 am

Hi fsalvelt,

Yes there is a performance issue , if the sessions were left idle..

Thanks,
Raj.
Rajasekhar.T|HP ATP Vertica Big Data Solutions V1

User avatar
piglet
Beginner
Beginner
Posts: 45
Joined: Tue Feb 07, 2012 4:04 pm

Re: Closing idle sessions automatically

Post by piglet » Sat Jul 21, 2012 11:13 am

Can we close sessions that are active?

Post Reply

Return to “Vertica Database Development”