반응형
/********************************************************************************************
-- Title : [9.2] 현재 사용중인 사용자(connected user) 확인 및 접속 해제(terminate user)
-- Reference : postgresql.org
-- Key word : postgresql 사용자 접속 connected user terminate user 접속 해제 kill
********************************************************************************************/

------------------------------
-- list of all connected sessions
------------------------------
SELECT pid, datid, datname, usesysid, usename, waiting, state, query
     , application_name
     , client_addr, client_hostname, client_port 
     , backend_start, xact_start, query_start, state_change
FROM pg_stat_activity;


----------------------------
-- kill all connected sessions
----------------------------
SELECT pg_terminate_backend(pid)
FROM pg_stat_activity
WHERE datname = 'tttdb';



반응형

+ Recent posts