Skip to content

Instantly share code, notes, and snippets.

@kamal-github
Created March 17, 2021 17:42
Show Gist options
  • Save kamal-github/983bcd70465f5b8ad986b74b9a31cfdf to your computer and use it in GitHub Desktop.
Save kamal-github/983bcd70465f5b8ad986b74b9a31cfdf to your computer and use it in GitHub Desktop.
postgres kill runaway queries
Check current acticity or running query

select pid, query from pg_stat_activity where state='active';

To Cancel

select pg_cancel_backend(<pid>);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment