Disable connections to a PostgreSQL database temporarily

Today I had to disable access to some PostgreSQL databases temporarily. This can be easily done using pgAdmin. Under database properties, set "Connection Limit " to 0 from the default of -1. The corresponding SQL statement is

ALTER DATABASE "dbname" WITH CONNECTION LIMIT = 0;

When you are ready to allow connections, change this back to -1.

Advertisement

One thought on “Disable connections to a PostgreSQL database temporarily

  1. Very nice tip. Thanks for sharing!!! Awesome!!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s