Skip to content

Instantly share code, notes, and snippets.

@lucasdavila
Created November 22, 2012 16:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lucasdavila/4131950 to your computer and use it in GitHub Desktop.
Save lucasdavila/4131950 to your computer and use it in GitHub Desktop.
Force postgresql dropdb without restarting
# first get the ids from the process that still connected to db
$ psql -d db_name -c "select procpid from pg_stat_activity where datname='db_name' and waiting is not false;"
# after, kill the process that still connected to db
$ kill procpid_returned_from_query
$ dropdb db_name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment