May 2019
Intermediate to advanced
600 pages
20h 46m
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 will 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>
Read now
Unlock full access