SELECT pid, now() - query_start as “runtime”, state, query ,*
FROM pg_stat_activity
WHERE
now() - query_start > ‘1 seconds’::interval
and datname=‘hotline’
and state!=‘idle’
–and (query like ‘select%’ or query like ‘SELECT%’ )
ORDER BY runtime desc;
select pg_cancel_backend(29612);