I have a rails application running over Postgres.
I have two servers: one for testing and the other for production.
Very often I need to clone the production
Here's a quick way to kill all the connections to your postgres database.
sudo kill -9 `ps -u postgres -o pid`
Warning: this will kill any running processes that the postgres user has open, so make sure you want to do this first.
postgres