Commit a0f5954a authored by Andres Freund's avatar Andres Freund

Increase max_wal_size's default from 128MB to 1GB.

The introduction of min_wal_size & max_wal_size in 88e98230 makes it
feasible to increase the default upper bound in checkpoint
size. Previously raising the default would lead to a increased disk
footprint, even if more segments weren't beneficial.  The low default of
checkpoint size is one of common performance problem users have thus
increasing the default makes sense.  Setups where the increase in
maximum disk usage is a problem will very likely have to run with a
modified configuration anyway.

Discussion: 54F4EFB8.40202@agliodbs.com,
    CA+TgmoZEAgX5oMGJOHVj8L7XOkAe05Gnf45rP40m-K3FhZRVKg@mail.gmail.com

Author: Josh Berkus, after a discussion involving lots of people.
parent 241f088f
...@@ -2430,7 +2430,7 @@ include_dir 'conf.d' ...@@ -2430,7 +2430,7 @@ include_dir 'conf.d'
checkpoints. This is a soft limit; WAL size can exceed checkpoints. This is a soft limit; WAL size can exceed
<varname>max_wal_size</> under special circumstances, like <varname>max_wal_size</> under special circumstances, like
under heavy load, a failing <varname>archive_command</>, or a high under heavy load, a failing <varname>archive_command</>, or a high
<varname>wal_keep_segments</> setting. The default is 128 MB. <varname>wal_keep_segments</> setting. The default is 1 GB.
Increasing this parameter can increase the amount of time needed for Increasing this parameter can increase the amount of time needed for
crash recovery. crash recovery.
This parameter can only be set in the <filename>postgresql.conf</> This parameter can only be set in the <filename>postgresql.conf</>
......
...@@ -475,7 +475,7 @@ ...@@ -475,7 +475,7 @@
linkend="guc-checkpoint-timeout"> seconds, or if linkend="guc-checkpoint-timeout"> seconds, or if
<xref linkend="guc-max-wal-size"> is about to be exceeded, <xref linkend="guc-max-wal-size"> is about to be exceeded,
whichever comes first. whichever comes first.
The default settings are 5 minutes and 128 MB, respectively. The default settings are 5 minutes and 1 GB, respectively.
If no WAL has been written since the previous checkpoint, new checkpoints If no WAL has been written since the previous checkpoint, new checkpoints
will be skipped even if <varname>checkpoint_timeout</> has passed. will be skipped even if <varname>checkpoint_timeout</> has passed.
(If WAL archiving is being used and you want to put a lower limit on how (If WAL archiving is being used and you want to put a lower limit on how
......
...@@ -79,7 +79,7 @@ extern uint32 bootstrap_data_checksum_version; ...@@ -79,7 +79,7 @@ extern uint32 bootstrap_data_checksum_version;
/* User-settable parameters */ /* User-settable parameters */
int max_wal_size = 8; /* 128 MB */ int max_wal_size = 64; /* 1 GB */
int min_wal_size = 5; /* 80 MB */ int min_wal_size = 5; /* 80 MB */
int wal_keep_segments = 0; int wal_keep_segments = 0;
int XLOGbuffers = -1; int XLOGbuffers = -1;
......
...@@ -2191,7 +2191,7 @@ static struct config_int ConfigureNamesInt[] = ...@@ -2191,7 +2191,7 @@ static struct config_int ConfigureNamesInt[] =
GUC_UNIT_XSEGS GUC_UNIT_XSEGS
}, },
&max_wal_size, &max_wal_size,
8, 2, INT_MAX, 64, 2, INT_MAX,
NULL, assign_max_wal_size, NULL NULL, assign_max_wal_size, NULL
}, },
......
...@@ -199,7 +199,7 @@ ...@@ -199,7 +199,7 @@
# - Checkpoints - # - Checkpoints -
#checkpoint_timeout = 5min # range 30s-1h #checkpoint_timeout = 5min # range 30s-1h
#max_wal_size = 128MB # in logfile segments #max_wal_size = 1GB
#min_wal_size = 80MB #min_wal_size = 80MB
#checkpoint_completion_target = 0.5 # checkpoint target duration, 0.0 - 1.0 #checkpoint_completion_target = 0.5 # checkpoint target duration, 0.0 - 1.0
#checkpoint_warning = 30s # 0 disables #checkpoint_warning = 30s # 0 disables
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment