If you ever used watch -n 3 ...
to run your SQL query every 3 seconds,
rejoice because Postgres provides a way to do this without leaving the psql prompt.
First run the command you’d like to repeat:
test-db=# SELECT now();
Then just type \watch X to repeat your query every X seconds:
test-db=# \watch 3
Watch every 3s Mon Jun 20 13:44:53 2016
now
───────────────────────────────
2016-06-20 13:44:53.739159+08