Last active
          February 7, 2018 17:02 
        
      - 
      
- 
        Save marcotc/6655b8af1ed2d5fd69856e7cf020a03f to your computer and use it in GitHub Desktop. 
Revisions
- 
        marcotc revised this gist Feb 7, 2018 . 1 changed file with 1 addition and 3 deletions.There are no files selected for viewingThis file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,4 @@ ActiveRecord::Base.connection.exec_query("SELECT pid, age(query_start, clock_timestamp()), state, query FROM pg_stat_activity WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' and state = 'active' ORDER BY age(query_start, clock_timestamp())") #ActiveRecord::Base.connection.exec_query("select pg_cancel_backend(123456)") # Kill by PID 
- 
        marcotc created this gist Feb 6, 2018 .There are no files selected for viewingThis file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,6 @@ ActiveRecord::Base.connection.exec_query(" SELECT pid, age(query_start, clock_timestamp()), state, query FROM pg_stat_activity WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' and state = 'active' ORDER BY age(query_start, clock_timestamp()) ") #ActiveRecord::Base.connection.exec_query("select pg_cancel_backend(123456)") # Kill by PID