How to monitor currently running queries, Linux command-line

From: Aleksey Tsalolikhin <atsaloli(dot)tech(at)gmail(dot)com>
To: Los Angeles PostgreSQL Users Group <lapug(at)postgresql(dot)org>
Subject: How to monitor currently running queries, Linux command-line
Date: 2010-09-14 19:35:31
Message-ID: AANLkTikPosCAdKDUZxCKmjzbj8GdK5s8OZDK47vC8x-9@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: lapug

This might be old hat for you guys, but I just found out how to set up
a dynamically
updated xterm window showing currently running queries:

watch "psql -U postgres -c 'SELECT datname,procpid,current_query FROM
pg_stat_activity;'|grep -v IDLE|grep -v 'SELECT
datname,procpid,current_query FROM pg_stat_activity;' | grep -v ^\( |
grep -v 'datname | procpid ' | grep -v -- '-----------+---------+-' "

Make it update 4 times a second with adding "-n 0.25" argument to watch.

Best,
-at

Browse lapug by date

  From Date Subject
Next Message Richard Broersma 2010-10-21 20:53:27 Seeking PGDay Volunteers
Previous Message Mark Wong 2010-05-26 02:12:49 Fwd: PDXPUG Day at OSCON 2010