Sunday, November 14, 2021

script check the all active connections to the db database by using the following query:

script check the all active connections to the db database by using the following query: 


select usename,datname FROM pg_stat_activity;


SELECT  *

FROM pg_stat_activity

WHERE datname = 'db';



terminate all the connections to the db database by using the following statement:


SELECT

    pg_terminate_backend (pid)

FROM

    pg_stat_activity

WHERE

    datname = 'db';

No comments:

Post a Comment