The Vertica Forum recently got a makeover! Let us know what you think by filling out this short, anonymous survey.

Display Canceled Queries

We can cancel a long running query in vsql by typing CTRL+C. The data collector table DC_CANCELS tracks queries that were stopped in this manner.


dbadmin=> SELECT table_name, component, description
dbadmin->   FROM data_collector
dbadmin->   WHERE component = 'Cancels';
table_name | component |   description
dc_cancels | Cancels   | Canceled queries
(1 row)

dbadmin=> SELECT * FROM dc_cancels;
time | node_name | session_id | user_id | txn_id | user_name | active_query | reason
(0 rows)

Now I will run a simple SQL statement and hit CTRL+C after waiting for 2 seconds:

dbadmin=> SELECT SLEEP(30);
Cancel request sent
(1 row)

dbadmin=> \x
Expanded display is on.

dbadmin=> SELECT * FROM dc_cancels;
-[ RECORD 1 ]+----------------------------------
time         | 2018-11-08 04:30:22.246344-05
node_name    | v_test_db_node0001
session_id   | v_test_db_node0001-156234:0x7e7d2
user_id      | 45035996273704962
txn_id       | 45035996274463388
user_name    | dbadmin
active_query | SELECT SLEEP(30);
reason       | Session canceled on the initiator

Helpful Link:

Have fun!

Sign In or Register to comment.

Can't find what you're looking for? Search the Vertica Documentation, Knowledge Base, or Blog for more information.