SQL to display Database Locks and Resource Queues in Greenplum
--check_waiting_lock
SELECT usename,COUNT(DISTINCT pid) FROM pg_locks l JOIN pg_stat_activity a ON (a.procpid=l.pid) WHERE l.granted IS FALSE GROUP BY 1 ORDER BY count DESC;
--check_size_of_resource_queue
SELECT * FROM pg_resqueue_status;