Check current acticity or running query select pid, query from pg_stat_activity where state='active'; To Cancel select pg_cancel_backend(<pid>);