Home Explore Blog CI



postgresql

56th chunk of `doc/src/sgml/config.sgml`
1641c912aa21eeeddfcf5dd942926b3bea30864beedb758a0000000100000fbf
 time (which suggests that
        <varname>max_wal_size</varname> ought to be raised).
        If this value is specified without units, it is taken as seconds.
        The default is 30 seconds (<literal>30s</literal>).
        Zero disables the warning.
        No warnings will be generated if <varname>checkpoint_timeout</varname>
        is less than <varname>checkpoint_warning</varname>.
        This parameter can only be set in the <filename>postgresql.conf</filename>
        file or on the server command line.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry id="guc-max-wal-size" xreflabel="max_wal_size">
      <term><varname>max_wal_size</varname> (<type>integer</type>)
      <indexterm>
       <primary><varname>max_wal_size</varname> configuration parameter</primary>
      </indexterm>
      </term>
      <listitem>
       <para>
        Maximum size to let the WAL grow during automatic
        checkpoints. This is a soft limit; WAL size can exceed
        <varname>max_wal_size</varname> under special circumstances, such as
        heavy load, a failing <varname>archive_command</varname> or <varname>archive_library</varname>, or a high
        <varname>wal_keep_size</varname> setting.
        If this value is specified without units, it is taken as megabytes.
        The default is 1 GB.
        Increasing this parameter can increase the amount of time needed for
        crash recovery.
        This parameter can only be set in the <filename>postgresql.conf</filename>
        file or on the server command line.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry id="guc-min-wal-size" xreflabel="min_wal_size">
      <term><varname>min_wal_size</varname> (<type>integer</type>)
      <indexterm>
       <primary><varname>min_wal_size</varname> configuration parameter</primary>
      </indexterm>
      </term>
      <listitem>
       <para>
        As long as WAL disk usage stays below this setting, old WAL files are
        always recycled for future use at a checkpoint, rather than removed.
        This can be used to ensure that enough WAL space is reserved to
        handle spikes in WAL usage, for example when running large batch
        jobs.
        If this value is specified without units, it is taken as megabytes.
        The default is 80 MB.
        This parameter can only be set in the <filename>postgresql.conf</filename>
        file or on the server command line.
       </para>
      </listitem>
     </varlistentry>

     </variablelist>
     </sect2>
     <sect2 id="runtime-config-wal-archiving">
     <title>Archiving</title>

    <variablelist>
     <varlistentry id="guc-archive-mode" xreflabel="archive_mode">
      <term><varname>archive_mode</varname> (<type>enum</type>)
      <indexterm>
       <primary><varname>archive_mode</varname> configuration parameter</primary>
      </indexterm>
      </term>
      <listitem>
       <para>
        When <varname>archive_mode</varname> is enabled, completed WAL segments
        are sent to archive storage by setting
        <xref linkend="guc-archive-command"/> or
        <xref linkend="guc-archive-library"/>. In addition to <literal>off</literal>,
        to disable, there are two modes: <literal>on</literal>, and
        <literal>always</literal>. During normal operation, there is no
        difference between the two modes, but when set to <literal>always</literal>
        the WAL archiver is enabled also during archive recovery or standby
        mode. In <literal>always</literal> mode, all files restored from the archive
        or streamed with streaming replication will be archived (again). See
        <xref linkend="continuous-archiving-in-standby"/> for details.
       </para>
       <para>
        <varname>archive_mode</varname> is a separate setting from
        <varname>archive_command</varname> and
        <varname>archive_library</varname> so that
        <varname>archive_command</varname> and
        <varname>archive_library</varname>

Title: Max WAL Size, Min WAL Size, and Archive Mode in PostgreSQL
Summary
This section covers PostgreSQL configuration parameters related to WAL size and archiving. It details `max_wal_size` (soft limit for WAL growth during checkpoints), `min_wal_size` (minimum WAL disk usage to trigger WAL file recycling), and `archive_mode` (enables WAL segment archiving via `archive_command` or `archive_library`, with 'on' and 'always' modes differing during recovery or standby).