Tom Lane wrote:
> Actually the reason it's not enabled by default today has nothing to do
> with either of those; it's
>
> 3. Unexpected side effects on foreground processes, such as surprising
> failures of DROP DATABASE commands. (See archives for details.)
>
> Until (3) is addressed I don't think there is any chance of having
> autovac on by default, and so worrying about (1) and (2) seems a bit
> premature. Or at least, if you want to work on those fine, but don't
> expect that it will alter the fact that the factory default is "off".
With that taken care of, do I dare propose enabling autovacuum by
default, so that further changes will be picked up quickly by the
buildfarm?
Attached is a patch to do so, based on Peter's last attempt at doing
this.
--
Alvaro Herrera http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.
Index: doc/src/sgml/config.sgml
===================================================================
RCS file: /home/alvherre/Code/cvs/pgsql/doc/src/sgml/config.sgml,v
retrieving revision 1.101
diff -c -p -r1.101 config.sgml
*** doc/src/sgml/config.sgml 9 Jan 2007 22:16:46 -0000 1.101
--- doc/src/sgml/config.sgml 16 Jan 2007 13:37:39 -0000
*************** SELECT * FROM parent WHERE key = 2400;
*** 3043,3049 ****
<listitem>
<para>
Enables the collection of row-level statistics on database
! activity. This parameter is off by default.
Only superusers can change this setting.
</para>
</listitem>
--- 3043,3050 ----
<listitem>
<para>
Enables the collection of row-level statistics on database
! activity. This parameter is on by default, because the autovacuum
! daemon needs the collected information.
Only superusers can change this setting.
</para>
</listitem>
Index: doc/src/sgml/maintenance.sgml
===================================================================
RCS file: /home/alvherre/Code/cvs/pgsql/doc/src/sgml/maintenance.sgml,v
retrieving revision 1.65
diff -c -p -r1.65 maintenance.sgml
*** doc/src/sgml/maintenance.sgml 27 Dec 2006 14:55:17 -0000 1.65
--- doc/src/sgml/maintenance.sgml 16 Jan 2007 13:40:33 -0000
*************** HINT: Stop the postmaster and use a sta
*** 477,483 ****
linkend="guc-stats-start-collector"> and <xref
linkend="guc-stats-row-level"> are set to <literal>true</literal>. Also,
it's important to allow a slot for the autovacuum process when choosing
! the value of <xref linkend="guc-superuser-reserved-connections">.
</para>
<para>
--- 477,485 ----
linkend="guc-stats-start-collector"> and <xref
linkend="guc-stats-row-level"> are set to <literal>true</literal>. Also,
it's important to allow a slot for the autovacuum process when choosing
! the value of <xref linkend="guc-superuser-reserved-connections">. In
! the default configuration, autovacuuming is enabled and the related
! configuration parameters are appropriately set.
</para>
<para>
Index: src/backend/utils/misc/guc.c
===================================================================
RCS file: /home/alvherre/Code/cvs/pgsql/src/backend/utils/misc/guc.c,v
retrieving revision 1.367
diff -c -p -r1.367 guc.c
*** src/backend/utils/misc/guc.c 9 Jan 2007 22:16:46 -0000 1.367
--- src/backend/utils/misc/guc.c 16 Jan 2007 13:37:39 -0000
*************** static struct config_bool ConfigureNames
*** 711,717 ****
NULL
},
&pgstat_collect_tuplelevel,
! false, NULL, NULL
},
{
{"stats_block_level", PGC_SUSET, STATS_COLLECTOR,
--- 711,717 ----
NULL
},
&pgstat_collect_tuplelevel,
! true, NULL, NULL
},
{
{"stats_block_level", PGC_SUSET, STATS_COLLECTOR,
*************** static struct config_bool ConfigureNames
*** 748,754 ****
NULL
},
&autovacuum_start_daemon,
! false, NULL, NULL
},
{
--- 748,754 ----
NULL
},
&autovacuum_start_daemon,
! true, NULL, NULL
},
{
Index: src/backend/utils/misc/postgresql.conf.sample
===================================================================
RCS file: /home/alvherre/Code/cvs/pgsql/src/backend/utils/misc/postgresql.conf.sample,v
retrieving revision 1.201
diff -c -p -r1.201 postgresql.conf.sample
*** src/backend/utils/misc/postgresql.conf.sample 9 Jan 2007 22:16:46 -0000 1.201
--- src/backend/utils/misc/postgresql.conf.sample 16 Jan 2007 13:41:04 -0000
***************
*** 349,355 ****
#stats_start_collector = on # needed for block or row stats
# (change requires restart)
#stats_block_level = off
! #stats_row_level = off
#stats_reset_on_server_start = off # (change requires restart)
--- 349,355 ----
#stats_start_collector = on # needed for block or row stats
# (change requires restart)
#stats_block_level = off
! #stats_row_level = on
#stats_reset_on_server_start = off # (change requires restart)
***************
*** 365,371 ****
# AUTOVACUUM PARAMETERS
#---------------------------------------------------------------------------
! #autovacuum = off # enable autovacuum subprocess?
# 'on' requires stats_start_collector
# and stats_row_level to also be on
#autovacuum_naptime = 1min # time between autovacuum runs
--- 365,371 ----
# AUTOVACUUM PARAMETERS
#---------------------------------------------------------------------------
! #autovacuum = on # enable autovacuum subprocess?
# 'on' requires stats_start_collector
# and stats_row_level to also be on
#autovacuum_naptime = 1min # time between autovacuum runs
---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend