You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SELECTblocked_locks.pidAS blocked_pid,
blocked_activity.usenameAS blocked_user,
blocking_locks.pidAS blocking_pid,
blocking_activity.usenameAS blocking_user,
blocked_activity.queryAS blocked_statement,
blocking_activity.queryAS current_statement_in_blocking_process
FROMpg_catalog.pg_locks blocked_locks
JOINpg_catalog.pg_stat_activity blocked_activity ONblocked_activity.pid=blocked_locks.pidJOINpg_catalog.pg_locks blocking_locks
ONblocking_locks.locktype=blocked_locks.locktypeANDblocking_locks.DATABASE IS NOT DISTINCT FROMblocked_locks.DATABASEANDblocking_locks.relation IS NOT DISTINCT FROMblocked_locks.relationANDblocking_locks.page IS NOT DISTINCT FROMblocked_locks.pageANDblocking_locks.tuple IS NOT DISTINCT FROMblocked_locks.tupleANDblocking_locks.virtualxid IS NOT DISTINCT FROMblocked_locks.virtualxidANDblocking_locks.transactionid IS NOT DISTINCT FROMblocked_locks.transactionidANDblocking_locks.classid IS NOT DISTINCT FROMblocked_locks.classidANDblocking_locks.objid IS NOT DISTINCT FROMblocked_locks.objidANDblocking_locks.objsubid IS NOT DISTINCT FROMblocked_locks.objsubidANDblocking_locks.pid!=blocked_locks.pidJOINpg_catalog.pg_stat_activity blocking_activity ONblocking_activity.pid=blocking_locks.pidWHERE NOT blocked_locks.GRANTED;
postgres lock monitoring 02
SET application_name='%your_logical_name%';
SELECTblocked_locks.pidAS blocked_pid,
blocked_activity.usenameAS blocked_user,
blocking_locks.pidAS blocking_pid,
blocking_activity.usenameAS blocking_user,
blocked_activity.queryAS blocked_statement,
blocking_activity.queryAS current_statement_in_blocking_process,
blocked_activity.application_nameAS blocked_application,
blocking_activity.application_nameAS blocking_application
FROMpg_catalog.pg_locks blocked_locks
JOINpg_catalog.pg_stat_activity blocked_activity ONblocked_activity.pid=blocked_locks.pidJOINpg_catalog.pg_locks blocking_locks
ONblocking_locks.locktype=blocked_locks.locktypeANDblocking_locks.DATABASE IS NOT DISTINCT FROMblocked_locks.DATABASEANDblocking_locks.relation IS NOT DISTINCT FROMblocked_locks.relationANDblocking_locks.page IS NOT DISTINCT FROMblocked_locks.pageANDblocking_locks.tuple IS NOT DISTINCT FROMblocked_locks.tupleANDblocking_locks.virtualxid IS NOT DISTINCT FROMblocked_locks.virtualxidANDblocking_locks.transactionid IS NOT DISTINCT FROMblocked_locks.transactionidANDblocking_locks.classid IS NOT DISTINCT FROMblocked_locks.classidANDblocking_locks.objid IS NOT DISTINCT FROMblocked_locks.objidANDblocking_locks.objsubid IS NOT DISTINCT FROMblocked_locks.objsubidANDblocking_locks.pid!=blocked_locks.pidJOINpg_catalog.pg_stat_activity blocking_activity ONblocking_activity.pid=blocking_locks.pidWHERE NOT blocked_locks.GRANTED;