Search
 
SCRIPT & CODE EXAMPLE
 

SQL

postgresql stop all connections

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

how to stop all connections to a psql 12 database?

# Works for psql 12
select pg_terminate_backend(pid) from pg_stat_activity where datname='<db_name>';
Comment

postgres kill all connections

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

PREVIOUS NEXT
Code Example
Sql :: select not matching data with join table 
Sql :: oracle drop job 
Sql :: mysql current running queries 
Sql :: guid to string sql 
Sql :: GROUP BY clause; this is incompatible with sql_mode=only_full_group_by 
Sql :: port 5432 is already in use mac 
Sql :: mysql get date difference in hours 
Sql :: psql kill pid 
Sql :: psql: error: could not connect to server: No such file or directory 
Sql :: pl sql output 
Sql :: mysql workbench in ubuntu 14.04 
Sql :: mysql show databases 
Sql :: this month mysql where 
Sql :: sql server read uncommitted 
Sql :: start mysql server linux terminal 
Sql :: pl sql escape & 
Sql :: delete mysql from mac 
Sql :: how to drop databaselink in oracle 
Sql :: oracle search stored procedures for text 
Sql :: open postgress in terminal mac 
Sql :: mysql get time from datetime 
Sql :: create table if not exist in sqlite 
Sql :: oracle drop column 
Sql :: change mysql password from command line 
Sql :: how to update an attribute in MySQL 
Sql :: get columns number sql 
Sql :: sql drop multiple columns if exists 
Sql :: what is meant by trigger in dbms 
Sql :: SQL select past number of days 
Sql :: tsql find foreign key references 
ADD CONTENT
Topic
Content
Source link
Name
2+2 =