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

postgres killing connections on db

SELECT 
    pg_terminate_backend(pid) 
FROM 
    pg_stat_activity 
WHERE 
    -- don't kill my own connection!
    pid <> pg_backend_pid()
    -- don't kill the connections to other databases
    AND datname = 'database_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 :: sql server add identity column to existing table 
Sql :: sql print all names that start with a given letter 
Sql :: sql throw error 
Sql :: psql is not recognized 
Sql :: get the rows from two tables whose relation is in 3rd table 
Sql :: starting mysql service from mac 
Sql :: mysql id of inserted row 
Sql :: add new column to the table mysql 
Sql :: mysql bidirectional composite primary key 
Sql :: sql remove first character from string 
Sql :: oracle list data files 
Sql :: oracle check numeric 
Sql :: python mysql check if database exists 
Sql :: oracle sql first day of year 
Sql :: postgresql make each element in array distinct 
Sql :: how to insert string variable into sqlite database 
Sql :: What is the compatibility level of a SQL database 
Sql :: uninstall mysql server ubuntu 
Sql :: how to see all table partition in oracle 
Sql :: update select 
Sql :: sql select except null 
Sql :: select statement to print longest name 
Sql :: sql fill na with 0 
Sql :: add timestamp column to existing table t-sql 
Sql :: describe table query in postgresql 
Sql :: show tables postgresql 
Sql :: sql last 3 rows 
Sql :: mysql data types 
Sql :: hangfire clear all jobs 
Sql :: DB::transaction 
ADD CONTENT
Topic
Content
Source link
Name
7+2 =