Set a default autovacuum vacuum_cost_delay value of 20ms, to avoid excessive

I/O utilization, per discussion.

While at it, lower the autovacuum vacuum and analyze threshold values to 50
tuples.  It is a bit higher (i.e. more conservative) than what I originally
proposed but much better than the old values for small tables.
This commit is contained in:
Alvaro Herrera 2007-07-24 01:53:56 +00:00
parent ab7d2b6a73
commit 53d2951be7
3 changed files with 12 additions and 11 deletions

View File

@ -1,4 +1,4 @@
<!-- $PostgreSQL: pgsql/doc/src/sgml/config.sgml,v 1.131 2007/07/18 12:00:47 mha Exp $ --> <!-- $PostgreSQL: pgsql/doc/src/sgml/config.sgml,v 1.132 2007/07/24 01:53:55 alvherre Exp $ -->
<chapter Id="runtime-config"> <chapter Id="runtime-config">
<title>Server Configuration</title> <title>Server Configuration</title>
@ -3247,7 +3247,7 @@ SELECT * FROM parent WHERE key = 2400;
<para> <para>
Specifies the minimum number of updated or deleted tuples needed Specifies the minimum number of updated or deleted tuples needed
to trigger a <command>VACUUM</> in any one table. to trigger a <command>VACUUM</> in any one table.
The default is 500 tuples. The default is 50 tuples.
This parameter can only be set in the <filename>postgresql.conf</> This parameter can only be set in the <filename>postgresql.conf</>
file or on the server command line. file or on the server command line.
This setting can be overridden for individual tables by entries in This setting can be overridden for individual tables by entries in
@ -3265,7 +3265,7 @@ SELECT * FROM parent WHERE key = 2400;
<para> <para>
Specifies the minimum number of inserted, updated or deleted tuples Specifies the minimum number of inserted, updated or deleted tuples
needed to trigger an <command>ANALYZE</> in any one table. needed to trigger an <command>ANALYZE</> in any one table.
The default is 250 tuples. The default is 50 tuples.
This parameter can only be set in the <filename>postgresql.conf</> This parameter can only be set in the <filename>postgresql.conf</>
file or on the server command line. file or on the server command line.
This setting can be overridden for individual tables by entries in This setting can be overridden for individual tables by entries in
@ -3343,8 +3343,9 @@ SELECT * FROM parent WHERE key = 2400;
<para> <para>
Specifies the cost delay value that will be used in automatic Specifies the cost delay value that will be used in automatic
<command>VACUUM</> operations. If <literal>-1</> is <command>VACUUM</> operations. If <literal>-1</> is
specified (which is the default), the regular specified, the regular
<xref linkend="guc-vacuum-cost-delay"> value will be used. <xref linkend="guc-vacuum-cost-delay"> value will be used.
The default value is 20 milliseconds.
This parameter can only be set in the <filename>postgresql.conf</> This parameter can only be set in the <filename>postgresql.conf</>
file or on the server command line. file or on the server command line.
This setting can be overridden for individual tables by entries in This setting can be overridden for individual tables by entries in

View File

@ -10,7 +10,7 @@
* Written by Peter Eisentraut <peter_e@gmx.net>. * Written by Peter Eisentraut <peter_e@gmx.net>.
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.405 2007/07/10 13:14:21 mha Exp $ * $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.406 2007/07/24 01:53:56 alvherre Exp $
* *
*-------------------------------------------------------------------- *--------------------------------------------------------------------
*/ */
@ -1348,7 +1348,7 @@ static struct config_int ConfigureNamesInt[] =
GUC_UNIT_MS GUC_UNIT_MS
}, },
&autovacuum_vac_cost_delay, &autovacuum_vac_cost_delay,
-1, -1, 1000, NULL, NULL 20, -1, 1000, NULL, NULL
}, },
{ {
@ -1656,7 +1656,7 @@ static struct config_int ConfigureNamesInt[] =
NULL NULL
}, },
&autovacuum_vac_thresh, &autovacuum_vac_thresh,
500, 0, INT_MAX, NULL, NULL 50, 0, INT_MAX, NULL, NULL
}, },
{ {
{"autovacuum_analyze_threshold", PGC_SIGHUP, AUTOVACUUM, {"autovacuum_analyze_threshold", PGC_SIGHUP, AUTOVACUUM,
@ -1664,7 +1664,7 @@ static struct config_int ConfigureNamesInt[] =
NULL NULL
}, },
&autovacuum_anl_thresh, &autovacuum_anl_thresh,
250, 0, INT_MAX, NULL, NULL 50, 0, INT_MAX, NULL, NULL
}, },
{ {
/* see varsup.c for why this is PGC_POSTMASTER not PGC_SIGHUP */ /* see varsup.c for why this is PGC_POSTMASTER not PGC_SIGHUP */

View File

@ -381,9 +381,9 @@
#log_autovacuum = -1 # -1 is disabled, 0 logs all actions #log_autovacuum = -1 # -1 is disabled, 0 logs all actions
# and their durations, > 0 logs only # and their durations, > 0 logs only
# actions running at least N msec. # actions running at least N msec.
#autovacuum_vacuum_threshold = 500 # min # of tuple updates before #autovacuum_vacuum_threshold = 50 # min # of tuple updates before
# vacuum # vacuum
#autovacuum_analyze_threshold = 250 # min # of tuple updates before #autovacuum_analyze_threshold = 50 # min # of tuple updates before
# analyze # analyze
#autovacuum_vacuum_scale_factor = 0.2 # fraction of rel size before #autovacuum_vacuum_scale_factor = 0.2 # fraction of rel size before
# vacuum # vacuum
@ -391,7 +391,7 @@
# analyze # analyze
#autovacuum_freeze_max_age = 200000000 # maximum XID age before forced vacuum #autovacuum_freeze_max_age = 200000000 # maximum XID age before forced vacuum
# (change requires restart) # (change requires restart)
#autovacuum_vacuum_cost_delay = -1 # default vacuum cost delay for #autovacuum_vacuum_cost_delay = 20 # default vacuum cost delay for
# autovacuum, -1 means use # autovacuum, -1 means use
# vacuum_cost_delay # vacuum_cost_delay
#autovacuum_vacuum_cost_limit = -1 # default vacuum cost limit for #autovacuum_vacuum_cost_limit = -1 # default vacuum cost limit for