pg_wait_for_backend_termination()

一个提议的函数,用于等待一个后端终止
此条目与一项功能相关,该功能已包含在 PostgreSQL 14 中,但随后被撤销。
此条目与一个提议的PostgreSQL功能相关,该功能在公开发布之前已被撤回。

pg_wait_for_backend_termination() 是一个系统函数,用于等待一个后端终止。

pg_wait_for_backend_termination()PostgreSQL 14 中被添加,但随后被撤回。

用法

pg_wait_for_backend_termination ( pid INTEGER, timeout BIGINT DEFAULT 5000 ) → BOOLEAN

当使用 pg_terminate_backend() 尝试终止一个后端时,后端可能需要一些时间才能终止。 pg_wait_for_backend_termination() 为客户端提供了一种方法来确定终止何时发生。

请注意,必须提供超时值;无法指定无限超时。

变更历史

示例

postgres=# SELECT pg_wait_for_backend_termination(1268106);
WARNING:  backend with PID 1268106 did not terminate within 5000 milliseconds
 pg_wait_for_backend_termination 
---------------------------------
 f
(1 row)

Time: 5007.215 ms (00:05.007)

尝试确定不属于正在运行的 PostgreSQL 实例的 PID 的状态

postgres=# SELECT pg_wait_for_backend_termination(123456);
WARNING:  PID 123456 is not a PostgreSQL server process
 pg_wait_for_backend_termination 
---------------------------------
 f
(1 row)

分类

管理/行政, 系统函数, 已撤回

另请参阅

pg_terminate_backend()

反馈

就 "pg_wait_for_backend_termination()" 提交任何评论、建议或更正,请在此处 进行