重复执行上一条语句

最近更新时间: 2024-10-17 17:10:00

postgres=# select count(1) from pg_stat_activity where state!='idle';
 count 
-------
     1
(1 row)

postgres=# \watch 1
Fri 28 Sep 2018 04:58:51 PM CST (every 1s)

 count 
-------
     1
(1 row)

Fri 28 Sep 2018 04:58:52 PM CST (every 1s)

 count 
-------
     1
(1 row)

上面的语句为每次自动查询活跃的进程数,相当于临时监控作用。