07-20-2023, 02:04 PM
Case :
Fail to execute the query :
DROP TABLE dbo.t_tabelname
Solution :
a. Display query Status Activity as follow :
SELECT * FROM pg_stat_activity ;
b. Find row where 'Query' column has contains :
'DROP TABLE dbo.t_tabelname'
c. In the same row, get value of 'PID' Column
example : 16409
d. Execute these scripts :
SELECT
pg_terminate_backend(25263)
FROM
pg_stat_activity
WHERE
-- don't kill my own connection!
25263 <> pg_backend_pid()
-- don't kill the connections to other databases
AND datname = 'database_name'
;
Fail to execute the query :
DROP TABLE dbo.t_tabelname
Solution :
a. Display query Status Activity as follow :
SELECT * FROM pg_stat_activity ;
b. Find row where 'Query' column has contains :
'DROP TABLE dbo.t_tabelname'
c. In the same row, get value of 'PID' Column
example : 16409
d. Execute these scripts :
SELECT
pg_terminate_backend(25263)
FROM
pg_stat_activity
WHERE
-- don't kill my own connection!
25263 <> pg_backend_pid()
-- don't kill the connections to other databases
AND datname = 'database_name'
;