Tuesday, 16 July 2019

Currently running queries on Postgresql DB

shown, sorted from the longest running, with

select now()-query_start, * from pg_stat_activity where state<>'idle' order by 1 desc;

 canceled with: select pg_cancel_backend([PID]); 

 select pg_cancel_backend([PID]); 

or, if idle in transaction, with: 

 select pg_terminate_backend([PID]);

Currently running queries on Postgresql DB

shown, sorted from the longest running, with select now()-query_start, * from pg_stat_activity where state<> 'idle' order...