Re: Tail -f or watch for postgres - Mailing list pgsql-admin

From Scott Mead
Subject Re: Tail -f or watch for postgres
Date
Msg-id z2od3ab2ec81004200528l49aac38fj45a9612e2ab662b@mail.gmail.com
Whole thread Raw
In response to Re: Tail -f or watch for postgres  (Scott Marlowe <scott.marlowe@gmail.com>)
List pgsql-admin

On Tue, Apr 20, 2010 at 6:32 AM, Scott Marlowe <scott.marlowe@gmail.com> wrote:
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).

--Scott 
 

--
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin

pgsql-admin by date:

Previous
From: Scott Marlowe
Date:
Subject: Re: Tail -f or watch for postgres
Next
From: Tom Lane
Date:
Subject: Re: How to disconnect a single user in Postgresql 8.2.5 from a database