\watch
command is great in Postrges.
It appends an output of a query, being watched over and over.
For example, when I previously run a query SELECT id, nickname FROM users;
, and entered \watch
, in case of no new data, I get the same output over and over:
my_db=# SELECT id, nickname FROM users;
id | nickname
----+----------
1 | AntonAL
(1 row)
my_db=# \watch
четверг, 31 августа 2017 г. 13:23:26 (every 2s)
id | nickname
----+----------
1 | AntonAL
(1 row)
четверг, 31 августа 2017 г. 13:23:28 (every 2s)
id | nickname
----+----------
1 | AntonAL
(1 row)
It there any option to clear screen output, between watch executions?
I want to get dashboard-like experience, when a set of rows is displayed and refreshed, not appended over and over to the Postgres console output.
I had this problem, and with a suggestion from MatheusOl on #postgresql
, the following works for me:
\C `clear`
SELECT * FROM pg_tables \watch 10
The \C [value]
command sequence lets you set a title, and you can set that (shelling out with backticks) to the ANSI escapes returned by clear
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With