max_standby_archive_delay

类型: integer
默认: 30000 (30s)
最低限度: -1 (-1)
最大: 2147483647 (2147483647ms)
单元: milliseconds (ms)
上下文: sighup
重新开始: false

当热后备机处于活动状态时,这个参数决定取消那些与即将应用的 WAL 项冲突的后备机查询之前,后备服务器应该等待多久,如hot-standby-conflict中所述。 当 WAL 数据被从 WAL 归档(并且因此不是当前的 WAL)时,max_standby_archive_delay可以应用。 如果指定值时没有单位,则以毫秒为单位。默认值是 30 秒。值 -1 允许后备机一直等到冲突查询结束。 这个参数只能在postgresql.conf文件中或在服务器命令行上设置。

注意,max_standby_archive_delay与取消之前一个查询能够运行的最长时间不同;它表示应用任何一个 WAL 段数据能够被允许的最长总时间。因此,如果一个查询早于 WAL 段导致了显著的延迟,后续冲突查询将只有更少的时间。

建议 [EN]

If you are replicating primarily for failover, set this to a very low value (like 0) in order to keep the standby as up to date as possible. If this standby is running queries as its primary role, set to the length of time of the longest-running query you want to allow.

条评论