Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

lapug by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group