pg_stat_get_backend_activity_start()
是一个系统函数,报告指定后端最近查询的启动时间。
pg_stat_get_backend_activity_start()
在 PostgreSQL 7.4 中添加。
用法
pg_stat_get_backend_activity_start (integer
) →timestamp with time zone
后端由 pg_stat_get_backend_idset()
报告的后端 ID 号指定;请参见下面的执行示例。
pg_stat_get_backend_activity_start()
返回的值对应于 pg_stat_activity
中的 query_start
列。
相关函数
以下相关函数也可使用
pg_stat_get_backend_activity()
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_start()
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 7.4
- 添加 (提交 a1833100)
示例
pg_stat_get_backend_activity_start()
的基本执行示例
postgres=# SELECT pg_stat_get_backend_pid(s.backendid) AS pid, pg_stat_get_backend_activity_start(s.backendid) AS query_start FROM (SELECT pg_stat_get_backend_idset() AS backendid) AS s; pid | query_start -------+------------------------------- 23529 | 23532 | 18419 | 2021-07-20 04:29:24.54157+02 6177 | 18474 | 2021-07-20 04:26:35.539942+02 18427 | 2021-07-20 04:29:23.355595+02 18488 | 2021-07-20 04:27:18.906881+02 18185 | 2021-07-20 04:21:58.292271+02 16549 | 2021-07-20 03:38:12.636572+02 18489 | 2021-07-20 04:29:23.968442+02 18546 | 2021-07-20 04:29:26.69587+02 18359 | 2021-07-20 04:27:32.220973+02 18362 | 2021-07-20 04:29:06.522822+02 6233 | 18566 | 2021-07-20 04:29:49.440485+02 23527 | 23526 | 23528 | (18 rows)
参考文献
- PostgreSQL 文档: 每个后端统计函数