Monday, July 17, 2017

Listing Queries Runing in PostgreSQL DBMS

To see which queries are being executed by a user in PostgreSQL DBMS, one may use the following query,


SELECT 
       usename, application_name, state, query 
FROM
       pg_stat_activity 
WHERE 
       usename='my_user_name';
where my_user_name should be actual username being queried about.