Skip to content

Instantly share code, notes, and snippets.

@dreamlu
Created April 23, 2023 06:56
Show Gist options
  • Save dreamlu/eb12ee9ea6119f254821cca3221b8730 to your computer and use it in GitHub Desktop.
Save dreamlu/eb12ee9ea6119f254821cca3221b8730 to your computer and use it in GitHub Desktop.
pg 锁住/解锁
select pid, query
from pg_stat_activity
where datname = 'table'
and wait_event_type = 'Lock';
select 'select pg_cancel_backend( ''' || pid || ''');' pid
from pg_stat_activity
where datname = 'table'
and wait_event_type = 'Lock';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment