I want to drop all connections (sessions) that are currently opened to a specific postgresql database but without restarting the server or disconnecting connections to other databases.
How can I so that?
|
I want to drop all connections (sessions) that are currently opened to a specific postgresql database but without restarting the server or disconnecting connections to other databases. How can I so that? |
|||
|
|
The query like this should help (assuming the database is named 'db'):
However you have to be a superuser to disconnect other users. |
|||||
|
|
This can be used to "free" a database from client connections, so that you for example can rename it. One-Line-Example:
Be aware that this might cause problematic behaviour to your client apps. Data actualy should not be currupted due to using transactions. |
|||
|
|