Canceling Postgres queries
-- cancel (idle won't be removed)
select pg_cancel_backend(pid);
-- terminate
select pg_terminate_backend(pid);
-- cancel (idle won't be removed)
select pg_cancel_backend(pid);
-- terminate
select pg_terminate_backend(pid);