Re: Tail -f or watch for postgres

From: Scott Mead <scott(dot)lists(at)enterprisedb(dot)com>
To: Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com>
Cc: Renato Oliveira <renato(dot)oliveira(at)grant(dot)co(dot)uk>, "pgsql-admin(at)postgresql(dot)org" <pgsql-admin(at)postgresql(dot)org>
Subject: Re: Tail -f or watch for postgres
Date: 2010-04-20 12:28:08
Message-ID: z2od3ab2ec81004200528l49aac38fj45a9612e2ab662b@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On Tue, Apr 20, 2010 at 6:32 AM, Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com>wrote:

> On Tue, Apr 20, 2010 at 1:20 AM, Renato Oliveira
> <renato(dot)oliveira(at)grant(dot)co(dot)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(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-admin
>

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Tom Lane 2010-04-20 13:31:20 Re: How to disconnect a single user in Postgresql 8.2.5 from a database
Previous Message Scott Marlowe 2010-04-20 10:32:57 Re: Tail -f or watch for postgres