psql Watch Improvements
I saw this tip at Luca’s website
To use \watch:
| |
The above example will show me what is going on as CLUSTER or VACUUM with a refresh ratio of 5 seconds. One problem of the \watch command is that it loops forever, meaning you need to manually stop it (e.g., CTRL-c).
With PostgreSQL 16, you can now include a count so it will stop.
| |
This will watch every 2 seconds and stop after 7 times. The following is also correct:
\watch 2will go forever every 2 seconds.\watch 2 c=7will go every 2 seconds and stop after 7 times.\watch i=2 c=7
\watch 2 7is not valid.