-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
Recorded version of a vision talk presented at VLDB 2011 (37th International Conference on Very Large Data Bases). PowerPoint slides, paper, and online demo ...
M. Bender, S. Michel, P. Triantafillou, G. Weikum, and C. Zimmer. Proceedings of the 28th annual international ACM SIGIR conference on Research and development in information retrieval - SIGIR \textquotesingle05, ACM Press, (2005)