This section is about the file: web/bin/pg-kill-queries
Kill all queries that are a currently running on PostgreSQL database.
Useful in the sad cases that our recursive queries go infinite due to bugs.
#!/usr/bin/env bash
script_dir="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
# https://www.sqlprostudio.com/blog/8-killing-cancelling-a-long-running-postgres-query
"$script_dir/psql" -c "SELECT pg_cancel_backend(pid) FROM pg_stat_activity WHERE state = 'active' and pid <> pg_backend_pid();" "$@"


  1. OurBigBook Web PostgreSQL utils
  2. OurBigBook Web PostgreSQL
  3. OurBigBook Web development
  4. OurBigBook Web
  5. OurBigBook Project