:::::查询当前所有锁与对象的对应关系
select a.locktype,a.pid,a.relation,a.mode,a.granted,b.relname from pg_locks a,pg_class b where a.relation=b.oid;
:::::查询锁定query,用户
select usename,query,client_addr, query_start,pid,client_addr from pg_stat_activity where pid=15010; select query from pg_stat_activity where pid=15008;
:::::pg的锁类型
acesss share: 只与access exclusive冲突,select 加锁,在用户select时不能做ddl操作 row share: 与exclusive和access exclusive冲突,类似mysql共享意向锁,select for update/select for share 加锁