Skip to main content

concurrent sessions (check active or inactive)

  • December 17, 2013
  • 3 replies
  • 22 views

Patrick_2
How to check if a session is active or not ?


I'm new to vertica and I'm using this sql statement, but I'm not sure if I'm doing it right ?
any suggestion or sample query ?

select  count(*) from sessions where transaction_id > 0  => for active sessions 

select  count(*) from sessions where transaction_id <= 0  or current_statement ='  '
=> for active sessions 

regards,
Patrick

3 replies

Abhishek_Rana
Forum|alt.badge.img
  • Participating Frequently
  • December 17, 2013
In query_profiles table there is a flag is_executing, which can be used for running transaction quries.

select session_id,transaction_id,query from query_profiles where transaction_id in(select transaction_id from sessions)and is_executing='t'

Regards'

Abhishek

Daniel_Leybovic
Forum|alt.badge.img+1
  • Participating Frequently
  • December 17, 2013
Hi!

Table SESSIONS must be enough.


CURRENT_STATEMENT

The currently executing statement, if any. NULL indicates that no statement is currently being processed.


LAST_STATEMENT

NULL if the user has just logged in; otherwise the currently running statement or the most recently completed statement.


PS: It's so hard to read documentation :(


Daniel_Leybovic
Forum|alt.badge.img+1
  • Participating Frequently
  • December 17, 2013
Terrible formatting (exactly - terrible and not horrible).

GetSatisfaction - die!