pg_stat_get_backend_start()
是一个系统函数,用于获取指定后端启动的时间。
pg_stat_get_backend_start()
添加于 PostgreSQL 8.1。
用法
pg_stat_get_backend_start (integer
) →timestamp with time zone
后端由 pg_stat_get_backend_idset()
报告的后端 ID 号码指定;请参阅下面的执行示例。
pg_stat_get_backend_start()
返回的值对应于 pg_stat_activity
中的 backend_start
列。
相关函数
以下相关函数也可用
pg_stat_get_backend_activity()
pg_stat_get_backend_activity_start()
pg_stat_get_backend_client_addr()
pg_stat_get_backend_client_port()
pg_stat_get_backend_dbid()
pg_stat_get_backend_pid()
pg_stat_get_backend_userid()
pg_stat_get_backend_wait_event()
pg_stat_get_backend_wait_event_type()
pg_stat_get_backend_xact_start()
更改历史记录
- PostgreSQL 8.1
- 添加 (提交 4744c1a0)
示例
pg_stat_get_backend_start()
的基本用法示例
postgres=# SELECT pg_stat_get_backend_pid(s.backendid) AS pid, pg_stat_get_backend_start(s.backendid) AS backend_start FROM (SELECT pg_stat_get_backend_idset() AS backendid) AS s; pid | backend_start ---------+------------------------------- 1451980 | 2021-07-20 02:47:15.391157+02 1451982 | 2021-07-20 02:47:15.391324+02 2089310 | 2021-07-21 03:17:21.371758+02 1764534 | 2021-07-20 14:33:13.313114+02 1451978 | 2021-07-20 02:47:15.391042+02 1451977 | 2021-07-20 02:47:15.390958+02 1451979 | 2021-07-20 02:47:15.391104+02 (7 rows)
参考
- PostgreSQL 文档: 每个后端统计函数