On Tue, Apr 20, 2010 at 1:20 AM, Renato Oliveira <renato.oliveira@grant.co.uk> wrote: > Dear all, > > It may sounds crazy it may not sound so crazy. > > I was here think are there any commands to watch new transactions rolling > through the screen like a terminal monitor? > > For example, if you want to watch a log file you can execute the command; > tail –f <logfile> or watch. > > This will keep the log entries rolling and being displayed on screen. > > Is there something similar to postgreSQL?
while true; do psql mydb -c "select * from pg_stat_activity where current_query <>'<IDLE>'";sleep 10;done
or something like that.
That's a good one --
You could also set 'log_min_duration_statement = 1000 '
(This logs all statements taking 1 second or more into the logfile), then do a 'tail -f ' on the latest log in the pg_log folder. The lower you set log_min_duration_statement, the more overhead you place on your database (this could be significant, so be careful).