--GP查看锁
SELECT pid,rolname, rsqname, granted, current_query, datname FROM pg_roles, gp_toolkit.gp_resqueue_status, pg_locks, pg_stat_activity WHERE pg_roles.rolresqueue=pg_locks.objid AND pg_locks.objid=gp_toolkit.gp_resqueue_status.queueid AND pg_stat_activity.procpid=pg_locks.pid; --GP解除锁定 pg_cancel_backend(#pid)select * from pg_locks;select * from gp_dist_random('pg_locks') where locktype='relation' and mode='ExclusiveLock'
--查看锁的进程
select * from pg_stat_activity where procpid in (100685,7935);--GP解除锁定 select pg_cancel_backend(7935);select * from gp_dist_random('pg_stat_activity')
where procpid in( select pid from gp_dist_random('pg_locks') where locktype='relation' and mode='ExclusiveLock' ) and current_query is not null;