Sha256: b167de51fc49ea0562f7cc4a516748c1fc183e423d7b5ef2d439f9ebe7d31a7a
Contents?: true
Size: 654 Bytes
Versions: 11
Compression:
Stored size: 654 Bytes
Contents
module PgHero module Methods module Kill def kill(pid) PgHero.truthy? execute("SELECT pg_terminate_backend(#{pid.to_i})").first["pg_terminate_backend"] end def kill_long_running_queries long_running_queries.each { |query| kill(query["pid"]) } true end def kill_all select_all <<-SQL SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE pid <> pg_backend_pid() AND query <> '<insufficient privilege>' AND datname = current_database() SQL true end end end end
Version data entries
11 entries across 11 versions & 1 rubygems