Please don’t use this if you do not know what exactly gonna happen.
format :
psql -U{USERNAME} -h{HOSTNAME} {DATABASE_NAME} -c "select pid from pg_stat_activity" -t | xargs -n1 -I {} psql -c "SELECT pg_terminate_backend({})"
change the variable with that suits to your configuration, i put sampel below
sample :
psql -Ugoogleadmin -hgoogle_com google_production_db -c "select pid from pg_stat_activity" -t | xargs -n1 -I {} psql -c "SELECT pg_terminate_backend({})"