Heroku Postgres - terminate hung query (idle in transaction)

前端 未结 4 1878
猫巷女王i
猫巷女王i 2020-12-04 07:16

I\'m using Heroku with the Crane Postgres option and I was running a query on the database from my local machine when my local machine crashed. If I run

sel         


        
4条回答
  •  感情败类
    2020-12-04 07:55

    We can use the following to achieve it in a single query:

    SELECT pg_cancel_backend(pid), pg_terminate_backend(pid) FROM pg_stat_activity WHERE state != 'idle';
    

提交回复
热议问题