max_standby_streaming_delay

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

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

注意,max_standby_streaming_delay与取消之前一个查询能够运行的最长时间不同;它表示在从主服务器接收到 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.

条评论