Vertica : Whats Running ?

by bitznbitez

One of the common question in any database is “Whats running right now ?”   In Vertica 5 and 6 I have found the following pair of queries to be very useful.

dbadmin=> select node_name, user_name, current_statement from sessions;
 node_name | user_name | current_statement
 v_testdb_node0001 | dbadmin | select node_name, user_name, current_statement from sessions;
 (1 row)

The above query will list the user and the current sql they are running.  You can filter on user name etc.   At least in version 5 a very long sql may be truncated on display, however you will see enough of it to differentiate in most cases.

dbadmin=> select node_name, total_session_count, total_active_session_count, running_query_count from query_metrics;
 node_name | total_session_count | total_active_session_count | running_query_count
 v_testdb_node0001 | 290177 | 3 | 1
 (1 row)

The above query will show your nodes, the number of sessions and queries connected and active.   I have found this a good jumping off point when determining what is happening on a vertica cluster.

As always these examples are from a demo instance, I’m unable to show what a live system under load looks like since that would violate security policies.