Terminate all connections from specific schema in certain database

时间:2015-09-29 00:37:30

标签: postgresql database-connection schema

With this command I can terminate all connections running in a specific database.

SELECT pg_terminate_backend(pg_stat_activity.pid) 
FROM pg_stat_activity 
WHERE pg_stat_activity.datname = 'DATABASE_NAME' 
AND pid <> pg_backend_pid();

Is there a way to terminate connections in a certain schema only?

1 个答案:

答案 0 :(得分:1)

No. PostgreSQL connections are always to a database, not to a schema.

Related question on dba.SE: