Re: patch to add \watch to psql

From: Abhijit Menon-Sen <ams(at)2ndQuadrant(dot)com>
To: Will Leinweber <will(at)heroku(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: patch to add \watch to psql
Date: 2012-10-20 07:19:03
Message-ID: 20121020071903.GA21485@toroid.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

At 2012-10-19 17:15:27 -0700, will(at)heroku(dot)com wrote:
>
> will=# \watch select now();
> Watch every 2s Fri Oct 19 17:09:23 2012
>
> now
> -------------------------------
> 2012-10-19 17:09:23.743176-07
> (1 row)

The patch looks OK at first glance, and I can confirm that it works as
intended. I can imagine this functionality being useful, e.g. to watch
pg_stat_activity or similar tables.

But a big part of why watch(1) is nice is that the output is overwritten
rather than scrolling. When it's scrolling, it's (a) difficult to notice
that something has changed, and (b) harder to compare values, especially
when the interval is short.

For these reasons, I can imagine using "watch -n2 psql -c …", but not
\watch in its present form. (Of course, I doubt anyone would be enthused
about a proposal to link ncurses into psql, but that's another matter.)

Maybe you should call it \repeat or something. I'm sure people would get
around to using \watch that way eventually. :-)

-- Abhijit

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Kohei KaiGai 2012-10-20 07:24:35 Re: Move postgresql_fdw_validator into dblink
Previous Message Abhijit Menon-Sen 2012-10-20 06:43:27 Re: [PATCH] explain tup_fetched/returned in monitoring-stats