Rob*_*ert 7 postgresql postgresql-9.4
我正在使用 postgresql-9.4,为了支持和监控任务,我需要知道我的服务器已经运行了多长时间?有什么功能或方法可以知道这一点吗?有没有一种 sql 方法可以知道我的服务器何时启动?
我真的需要知道自它开始以来经过的时间吗?
a_h*_*ame 12
使用内置函数 pg_postmaster_start_time
select current_timestamp - pg_postmaster_start_time() as uptime
Run Code Online (Sandbox Code Playgroud)
手册中的更多详细信息:http : //www.postgresql.org/docs/current/static/functions-info.html
如果你想要秒,请使用extract:
select extract(epoch from current_timestamp - pg_postmaster_start_time()) as uptime
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4761 次 |
| 最近记录: |