Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id D2CBF632DF0 for ; Tue, 20 Apr 2010 09:28:32 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 50857-07 for ; Tue, 20 Apr 2010 12:28:22 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from exprod7og119.obsmtp.com (exprod7og119.obsmtp.com [64.18.2.16]) by mail.postgresql.org (Postfix) with SMTP id 766D0632177 for ; Tue, 20 Apr 2010 09:28:21 -0300 (ADT) Received: from source ([72.14.220.156]) by exprod7ob119.postini.com ([64.18.6.12]) with SMTP ID DSNKS82d48/QYPlInIaqP21OvxLhIiQxetXe@postini.com; Tue, 20 Apr 2010 05:28:21 PDT Received: by fg-out-1718.google.com with SMTP id e21so3144691fga.0 for ; Tue, 20 Apr 2010 05:28:19 -0700 (PDT) MIME-Version: 1.0 Received: by 10.223.123.201 with HTTP; Tue, 20 Apr 2010 05:28:08 -0700 (PDT) In-Reply-To: References: <7965A9DCF12CC14984420BCC37B1608F25AC0B9EF1@Elzar.grant.co.uk> Date: Tue, 20 Apr 2010 08:28:08 -0400 Received: by 10.223.16.84 with SMTP id n20mr984802faa.94.1271766488205; Tue, 20 Apr 2010 05:28:08 -0700 (PDT) Message-ID: Subject: Re: Tail -f or watch for postgres From: Scott Mead To: Scott Marlowe Cc: Renato Oliveira , "pgsql-admin@postgresql.org" Content-Type: multipart/alternative; boundary=00151747c002c44a430484aa3585 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.899 tagged_above=-10 required=5 tests=BAYES_00=-1.9, HTML_MESSAGE=0.001 X-Spam-Level: X-Archive-Number: 201004/269 X-Sequence-Number: 34363 --00151747c002c44a430484aa3585 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable On Tue, Apr 20, 2010 at 6:32 AM, Scott Marlowe wro= te: > On Tue, Apr 20, 2010 at 1:20 AM, Renato Oliveira > 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 rolli= ng > > through the screen like a terminal monitor? > > > > For example, if you want to watch a log file you can execute the comman= d; > > tail =96f 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 <>''";sleep 10;done > > or something like that. > That's a good one -- You could also set 'log_min_duration_statement =3D 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 yo= u set log_min_duration_statement, the more overhead you place on your databas= e (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 > --00151747c002c44a430484aa3585 Content-Type: text/html; charset=windows-1252 Content-Transfer-Encoding: quoted-printable
On Tue, Apr 20, 2010 at 6:32 AM, Scott Marlo= we <scott.m= arlowe@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 roll= ing
> through the screen like a terminal monitor?
>
> For example, if you want to watch a log file you can execute the comma= nd;
> tail =96f <logfile> or watch.
>
> This will keep the log entries rolling and being displayed on screen.<= br> >
> Is there something similar to postgreSQL?

while true; do psql mydb -c "select * from pg_stat_activity wher= e
current_query <>'<IDLE>'";sleep 10;done

or something like that.

That's a go= od one --=A0

=A0=A0You could also set 'log_min= _duration_statement =3D 1000 '

=A0=A0 =A0(This= logs all statements taking 1 second or more into the logfile), then do a &= #39;tail -f ' on the latest log in the pg_log folder. =A0 The lower you= set log_min_duration_statement, the more overhead you place on your databa= se (this could be significant, so be careful).

--Scott=A0
=A0

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

--00151747c002c44a430484aa3585--