Processlist
select * from pg_stat_activity;
Exclude IDLE processes
select * from pg_stat_activity WHERE current_query not like '<IDLE>%';
Current running queries
select current_query,count(*) from pg_stat_activity WHERE current_query not like '<IDLE>%' group by current_query order by count(*) desc;
Queries holding Exclusive locks
select * from pg_stat_activity where procpid in(select pid from pg_locks where mode='ExclusiveLock');
select pid,count(*) from pg_locks where mode='ExclusiveLock' group by pid order by count(*) desc;
Kill a running query
SELECT pg_cancel_backend(procpid);
select * from pg_stat_activity;
Exclude IDLE processes
select * from pg_stat_activity WHERE current_query not like '<IDLE>%';
Current running queries
select current_query,count(*) from pg_stat_activity WHERE current_query not like '<IDLE>%' group by current_query order by count(*) desc;
Queries holding Exclusive locks
select * from pg_stat_activity where procpid in(select pid from pg_locks where mode='ExclusiveLock');
select pid,count(*) from pg_locks where mode='ExclusiveLock' group by pid order by count(*) desc;
Kill a running query
SELECT pg_cancel_backend(procpid);
No comments:
Post a Comment