diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml index 7befc63860..6cad079132 100644 --- a/doc/src/sgml/config.sgml +++ b/doc/src/sgml/config.sgml @@ -7342,7 +7342,7 @@ COPY postgres_log FROM '/full/path/to/logfile.csv' WITH csv; Specifies a fraction of the table size to add to autovacuum_vacuum_insert_threshold when deciding whether to trigger a VACUUM. - The default is 0.0, which means that the table size has no effect. + The default is 0.01 (1% of table size). This parameter can only be set in the postgresql.conf file or on the server command line; but the setting can be overridden for individual tables by diff --git a/doc/src/sgml/maintenance.sgml b/doc/src/sgml/maintenance.sgml index dbf418c62a..904fbffd94 100644 --- a/doc/src/sgml/maintenance.sgml +++ b/doc/src/sgml/maintenance.sgml @@ -777,20 +777,28 @@ vacuum threshold = vacuum base threshold + vacuum scale factor * number of tuple , and the number of tuples is pg_class.reltuples. - The number of obsolete tuples is obtained from the statistics - collector; it is a semi-accurate count updated by each - UPDATE and DELETE operation. (It - is only semi-accurate because some information might be lost under heavy - load.) If the relfrozenxid value of the table is more + The table is also vacuumed if the number of tuples inserted since the last + vacuum have exceeded the defined insert threshold, which is defined as: + +vacuum insert threshold = vacuum base insert threshold + vacuum insert scale factor * number of tuples + + where the vacuum insert base threshold is + , + and vacuum insert scale factor is + . + Such vacuums may allow the table's relfrozenxid + to be advanced and will reduce the chances of and the impact of any + aggressive vacuums. + The number of obsolete tuples and the number of inserted tuples are + obtained from the statistics collector; it is a semi-accurate count updated by each + UPDATE, DELETE and + INSERT operation. (It is only semi-accurate because + some information might be lost under heavy load.) If the + relfrozenxid value of the table is more than vacuum_freeze_table_age transactions old, an aggressive vacuum is performed to freeze old tuples and advance relfrozenxid; otherwise, only pages that have been modified since the last vacuum are scanned. - Finally, a threshold similar to the above is calculated from - and - . - Tables that have received more inserts than the calculated threshold - since the last VACUUM will also be vacuumed. diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c index b4974a5f20..b7c526abc3 100644 --- a/src/backend/utils/misc/guc.c +++ b/src/backend/utils/misc/guc.c @@ -3545,7 +3545,7 @@ static struct config_real ConfigureNamesReal[] = NULL }, &autovacuum_vac_ins_scale, - 0.0, 0.0, 1e10, + 0.01, 0.0, 1e10, NULL, NULL, NULL }, diff --git a/src/backend/utils/misc/postgresql.conf.sample b/src/backend/utils/misc/postgresql.conf.sample index cc3df73a82..9988fe40f5 100644 --- a/src/backend/utils/misc/postgresql.conf.sample +++ b/src/backend/utils/misc/postgresql.conf.sample @@ -604,7 +604,7 @@ #autovacuum_analyze_threshold = 50 # min number of row updates before # analyze #autovacuum_vacuum_scale_factor = 0.2 # fraction of table size before vacuum -#autovacuum_vacuum_insert_scale_factor = 0.0 # fraction of table size before +#autovacuum_vacuum_insert_scale_factor = 0.01 # fraction of table size before # vacuum #autovacuum_analyze_scale_factor = 0.1 # fraction of table size before analyze #autovacuum_freeze_max_age = 200000000 # maximum XID age before forced vacuum