Tuesday, December 21, 2010

SQL Query to show current activities of the database server at Postgresql

0 comments
I executed the following query at Postgresql 9.0.1:

SELECT pg_stat_activity.datname, pg_stat_activity.procpid,
pg_stat_activity.usename, 
pg_stat_activity.current_query,
pg_stat_activity.waiting,
pg_stat_activity.query_start,pg_stat_activity.client_addr
FROM pg_stat_activity
WHERE ((pg_stat_activity.procpid <> pg_backend_pid())
AND (pg_stat_activity.current_query <> ''))
ORDER BY pg_stat_activity.query_start;

Leave a Reply

Labels