↑↓ select↵ open⌫ change scopeOpen full search

PG.CENTER connects PostgreSQL documentation, reference, and ecosystem knowledge. Maintained by Pigsty.

Wiki / Configuration Parameters

wal_keep_size

Specifies the minimum size of past WAL files kept in the pg_wal directory, in case a standby server needs to fetch them for streaming replication. If a standby server connected to the sending server falls behind by more than wal_keep_size megabytes, the sending server might remove a WAL segment still needed by the standby, in which case the replication connection will be terminated. Downstream connections will also eventually fail as a result. (However, the standby server can recover by fetching the segment from archive, if WAL archiving is in use.) This sets only the minimum size of segments retained in pg_wal; the system might need to retain more segments for WAL archival or to recover from a checkpoint. If wal_keep_size is zero (the default), the system doesn't keep any extra segments for standby purposes, so the number of old WAL segments available to standby servers is a function of the location of the previous checkpoint and status of WAL archiving. If this value is specified without units, it is taken as megabytes. This parameter can only be set in the postgresql.conf file or on the server command line.

English manual coverage begins with PostgreSQL 7.4. Source history and runtime observations have their own recorded version boundaries.

Reading PG 18·Select a recorded version

boot val
0
category
Replication / Sending Servers
context
sighup
doc same as
Unknown
documented
true
enumvals
Unknown
extra desc
Unknown
lang
en
max val
2147483647
metadata version
18
min val
0
name
wal_keep_size
short desc
Sets the size of WAL files held for standby servers.
source
pg-settings-source-snapshot
unit
MB
vartype
integer

Definition PG 18

Specifies the minimum size of past WAL files kept in the pg_wal directory, in case a standby server needs to fetch them for streaming replication. If a standby server connected to the sending server falls behind by more than wal_keep_size megabytes, the sending server might remove a WAL segment still needed by the standby, in which case the replication connection will be terminated. Downstream connections will also eventually fail as a result. (However, the standby server can recover by fetching the segment from archive, if WAL archiving is in use.)

This sets only the minimum size of segments retained in pg_wal; the system might need to retain more segments for WAL archival or to recover from a checkpoint. If wal_keep_size is zero (the default), the system doesn't keep any extra segments for standby purposes, so the number of old WAL segments available to standby servers is a function of the location of the previous checkpoint and status of WAL archiving. If this value is specified without units, it is taken as megabytes. This parameter can only be set in the postgresql.conf file or on the server command line.

Compare versions

Complete source facts

doc html

<p>
        Specifies the minimum size of past WAL files kept in the
        <code class="filename">pg_wal</code>
        directory, in case a standby server needs to fetch them for streaming
        replication. If a standby
        server connected to the sending server falls behind by more than
        <code class="varname">wal_keep_size</code> megabytes, the sending server might
        remove a WAL segment still needed by the standby, in which case the
        replication connection will be terminated.  Downstream connections
        will also eventually fail as a result.  (However, the standby
        server can recover by fetching the segment from archive, if WAL
        archiving is in use.)
       </p><p>
        This sets only the minimum size of segments retained in
        <code class="filename">pg_wal</code>; the system might need to retain more segments
        for WAL archival or to recover from a checkpoint. If
        <code class="varname">wal_keep_size</code> is zero (the default), the system
        doesn't keep any extra segments for standby purposes, so the number
        of old WAL segments available to standby servers is a function of
        the location of the previous checkpoint and status of WAL
        archiving.
        If this value is specified without units, it is taken as megabytes.
        This parameter can only be set in the
        <code class="filename">postgresql.conf</code> file or on the server command line.
       </p>

documentation revision

{"inputs":[{"file":"runtime-config-replication.html","kind":"same-version-reviewed-manual","locale":"en","sha256":"c0b8bd86131ec62d4df97ce480d004aa7e3544477d053f0c2d4047b9edad5cc0","version":"18.7"},{"file":"runtime-config-replication.html","kind":"same-version-reviewed-manual","locale":"zh-Hans","sha256":"83907b5f469e979a7b9ec875b5e7bdaa2ef6b85596ca31b45174f68cd7398b18","version":"18.7"}],"release":"18.7","runtime_remeasured":false,"source_revision":"pgdoc:b9f0e7232f60f380d642ac9b99226606c254b552"}

Source references

Full definition and evidence JSON

Definition sources

center · PostgreSQL 18 · wiki-repair-20261023:ee15467e323664f70e3c58869241aa78cd5b322ae4abcc517e956f3c4fa8e04f

Text language: en · wiki-repair-20261023:ee15467e323664f70e3c58869241aa78cd5b322ae4abcc517e956f3c4fa8e04f