Skip to content

Commit

Permalink
Kill running queries before migration (#3341)
Browse files Browse the repository at this point in the history
* Kill running queries before migration

* don't cancel self
  • Loading branch information
stereosteve committed Jun 29, 2022
1 parent 6c47cdb commit 9016770
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ def upgrade():
connection = op.get_bind()
connection.execute(
"""
SELECT pg_cancel_backend(pid)
FROM pg_stat_activity
WHERE state != 'idle' AND query NOT ILIKE '%pg_stat_activity%' and pid <> pg_backend_pid()
ORDER BY query_start DESC;
begin;
WITH new_plays AS (
SELECT
Expand Down

0 comments on commit 9016770

Please sign in to comment.