mirror of
https://git.postgresql.org/git/postgresql.git
synced 2025-01-12 18:34:36 +08:00
Default to log_checkpoints=on, log_autovacuum_min_duration=10m
The idea here is that when a performance problem is known to have occurred at a certain point in time, it's a good thing if there is some information available from the logs to help figure out what might have happened around that time. This change attracted an above-average amount of dissent, because it means that a server with default settings will produce some amount of log output even if nothing has gone wrong. However, by my count, the mailing list discussion had about twice as many people in favor of the change as opposed. The reasons for believing that the extra log output is not an issue in practice are: (1) the rate at which messages can be generated by this setting is bounded to one every few minutes on a properly-configured system and (2) production systems tend to have a lot more junk in the log from that due to failed connection attempts, ERROR messages generated by application activity, and the like. Bharath Rupireddy, reviewed by Fujii Masao and by me. Many other people commented on the thread, but as far as I can see that was discussion of the merits of the change rather than review of the patch. Discussion: https://postgr.es/m/CALj2ACX-rW_OeDcp4gqrFUAkf1f50Fnh138dmkd0JkvCNQRKGA@mail.gmail.com
This commit is contained in:
parent
5cc9c83740
commit
64da07c41a
@ -6764,19 +6764,18 @@ local0.* /var/log/postgresql
|
|||||||
<para>
|
<para>
|
||||||
Causes each action executed by autovacuum to be logged if it ran for at
|
Causes each action executed by autovacuum to be logged if it ran for at
|
||||||
least the specified amount of time. Setting this to zero logs
|
least the specified amount of time. Setting this to zero logs
|
||||||
all autovacuum actions. <literal>-1</literal> (the default) disables
|
all autovacuum actions. <literal>-1</literal> disables logging autovacuum
|
||||||
logging autovacuum actions.
|
actions. If this value is specified without units, it is taken as milliseconds.
|
||||||
If this value is specified without units, it is taken as milliseconds.
|
|
||||||
For example, if you set this to
|
For example, if you set this to
|
||||||
<literal>250ms</literal> then all automatic vacuums and analyzes that run
|
<literal>250ms</literal> then all automatic vacuums and analyzes that run
|
||||||
250ms or longer will be logged. In addition, when this parameter is
|
250ms or longer will be logged. In addition, when this parameter is
|
||||||
set to any value other than <literal>-1</literal>, a message will be
|
set to any value other than <literal>-1</literal>, a message will be
|
||||||
logged if an autovacuum action is skipped due to a conflicting lock or a
|
logged if an autovacuum action is skipped due to a conflicting lock or a
|
||||||
concurrently dropped relation. Enabling this parameter can be helpful
|
concurrently dropped relation. The default is <literal>10min</literal>.
|
||||||
in tracking autovacuum activity. This parameter can only be set in
|
Enabling this parameter can be helpful in tracking autovacuum activity.
|
||||||
the <filename>postgresql.conf</filename> file or on the server command line;
|
This parameter can only be set in the <filename>postgresql.conf</filename>
|
||||||
but the setting can be overridden for individual tables by
|
file or on the server command line; but the setting can be overridden for
|
||||||
changing table storage parameters.
|
individual tables by changing table storage parameters.
|
||||||
</para>
|
</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
@ -6793,7 +6792,7 @@ local0.* /var/log/postgresql
|
|||||||
Some statistics are included in the log messages, including the number
|
Some statistics are included in the log messages, including the number
|
||||||
of buffers written and the time spent writing them.
|
of buffers written and the time spent writing them.
|
||||||
This parameter can only be set in the <filename>postgresql.conf</filename>
|
This parameter can only be set in the <filename>postgresql.conf</filename>
|
||||||
file or on the server command line. The default is off.
|
file or on the server command line. The default is on.
|
||||||
</para>
|
</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
@ -107,7 +107,7 @@ char *wal_consistency_checking_string = NULL;
|
|||||||
bool *wal_consistency_checking = NULL;
|
bool *wal_consistency_checking = NULL;
|
||||||
bool wal_init_zero = true;
|
bool wal_init_zero = true;
|
||||||
bool wal_recycle = true;
|
bool wal_recycle = true;
|
||||||
bool log_checkpoints = false;
|
bool log_checkpoints = true;
|
||||||
int sync_method = DEFAULT_SYNC_METHOD;
|
int sync_method = DEFAULT_SYNC_METHOD;
|
||||||
int wal_level = WAL_LEVEL_MINIMAL;
|
int wal_level = WAL_LEVEL_MINIMAL;
|
||||||
int CommitDelay = 0; /* precommit delay in microseconds */
|
int CommitDelay = 0; /* precommit delay in microseconds */
|
||||||
|
@ -127,7 +127,7 @@ int autovacuum_multixact_freeze_max_age;
|
|||||||
double autovacuum_vac_cost_delay;
|
double autovacuum_vac_cost_delay;
|
||||||
int autovacuum_vac_cost_limit;
|
int autovacuum_vac_cost_limit;
|
||||||
|
|
||||||
int Log_autovacuum_min_duration = -1;
|
int Log_autovacuum_min_duration = 600000;
|
||||||
|
|
||||||
/* how long to keep pgstat data in the launcher, in milliseconds */
|
/* how long to keep pgstat data in the launcher, in milliseconds */
|
||||||
#define STATS_READ_DELAY 1000
|
#define STATS_READ_DELAY 1000
|
||||||
|
@ -1352,7 +1352,7 @@ static struct config_bool ConfigureNamesBool[] =
|
|||||||
NULL
|
NULL
|
||||||
},
|
},
|
||||||
&log_checkpoints,
|
&log_checkpoints,
|
||||||
false,
|
true,
|
||||||
NULL, NULL, NULL
|
NULL, NULL, NULL
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -3005,7 +3005,7 @@ static struct config_int ConfigureNamesInt[] =
|
|||||||
GUC_UNIT_MS
|
GUC_UNIT_MS
|
||||||
},
|
},
|
||||||
&Log_autovacuum_min_duration,
|
&Log_autovacuum_min_duration,
|
||||||
-1, -1, INT_MAX,
|
600000, -1, INT_MAX,
|
||||||
NULL, NULL, NULL
|
NULL, NULL, NULL
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -534,12 +534,12 @@
|
|||||||
#debug_print_rewritten = off
|
#debug_print_rewritten = off
|
||||||
#debug_print_plan = off
|
#debug_print_plan = off
|
||||||
#debug_pretty_print = on
|
#debug_pretty_print = on
|
||||||
#log_autovacuum_min_duration = -1 # log autovacuum activity;
|
#log_autovacuum_min_duration = 10min # log autovacuum activity;
|
||||||
# -1 disables, 0 logs all actions and
|
# -1 disables, 0 logs all actions and
|
||||||
# their durations, > 0 logs only
|
# their durations, > 0 logs only
|
||||||
# actions running at least this number
|
# actions running at least this number
|
||||||
# of milliseconds.
|
# of milliseconds.
|
||||||
#log_checkpoints = off
|
#log_checkpoints = on
|
||||||
#log_connections = off
|
#log_connections = off
|
||||||
#log_disconnections = off
|
#log_disconnections = off
|
||||||
#log_duration = off
|
#log_duration = off
|
||||||
|
@ -200,8 +200,8 @@ static bool authwarning = false;
|
|||||||
* but here it is more convenient to pass it as an environment variable
|
* but here it is more convenient to pass it as an environment variable
|
||||||
* (no quoting to worry about).
|
* (no quoting to worry about).
|
||||||
*/
|
*/
|
||||||
static const char *boot_options = "-F";
|
static const char *boot_options = "-F -c log_checkpoints=false";
|
||||||
static const char *backend_options = "--single -F -O -j -c search_path=pg_catalog -c exit_on_error=true";
|
static const char *backend_options = "--single -F -O -j -c search_path=pg_catalog -c exit_on_error=true -c log_checkpoints=false";
|
||||||
|
|
||||||
/* Additional switches to pass to backend (either boot or standalone) */
|
/* Additional switches to pass to backend (either boot or standalone) */
|
||||||
static char *extra_options = "";
|
static char *extra_options = "";
|
||||||
|
Loading…
Reference in New Issue
Block a user