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

PREVIOUS NEXT
Code Example
Sql :: sql query to make a existing column auto increment 
Sql :: fetch first 10 rows in oracle sql developer 
Sql :: select users 
Sql :: Mysql query add column with default string value 
Sql :: Failed to stop mysql.service: Unit mysql.service not loaded. 
Sql :: raise application error in oracle 
Sql :: find table from column name in sql 
Sql :: how to unlock table in mysql 
Sql :: get the list of all tables in sql server 
Sql :: primary key reset in SQL database 
Sql :: postgres change owner of schema 
Sql :: sql last 7 days 
Sql :: restart mysql server ubuntu 
Sql :: start mysql server mac 
Sql :: postgresql reset auto increment 
Sql :: how to add a index to live table sql 
Sql :: sql drop primary key 
Sql :: how to backup mysql database linux 
Sql :: query to check cpu utilization in oracle database 
Sql :: set sequence value oracle 
Sql :: reset auto increment in sql 
Sql :: mysql create database charset utf8mb4 
Sql :: mysql add column default value 
Sql :: drop procedure sql 
Sql :: sql remove first character from string 
Sql :: set password mysql 
Sql :: hw to delete a procedure in pl sql 
Sql :: sql server roles and users 
Sql :: date_format for time sql 
Sql :: return sql query laravel 
ADD CONTENT
Topic
Content
Source link
Name
1+4 =