Thursday 21 February 2019

In Postgres to see which connections are locking which table use the following command

 select * from pg_stat_activity where pid in (select pid from pg_locks where relation = (SELECT distinct attrelid FROM pg_attribute WHERE attrelid = 'onlineschema.vp_sequence_no'::regclass));