May 2018
Intermediate to advanced
576 pages
30h 25m
English
The \watch meta-command allows psql users to automatically (and continuously) re-execute a query.
This behavior is similar to the watch utility of some Linux and Unix environments.
In the following example, we run a simple query on pg_stat_activity and ask psql to repeat it every 5 seconds. You can exit at any time by pressing Ctrl + C:
gabriele=> SELECT count(*) FROM pg_stat_activity; count------- 1(1 row)gabriele=> \watch 5Watch every 5s Tue Aug 27 21:47:24 2013 count------- 1(1 row)<snip>