vimalkumar.in

/blog

Disable Connections to a PostgreSQL Database Temporarily

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

1
ALTER DATABASE "dbname" WITH CONNECTION LIMIT = 0;

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