+ linkend="guc-autovacuum-naptime"> seconds and determines which database
+ to process. Any database which is close to transaction ID wraparound
+ is immediately processed. In this case, autovacuum issues a
+ database-wide VACUUM call, or VACUUM
+ FREEZE if it's a template database, and then terminates. If
+ no database fulfills this criterion, the one that was least recently
+ processed by autovacuum itself is chosen. In this mode, each table in
+ the database is checked for new and obsolete tuples, according to the
+ applicable autovacuum parameters. If a
+ pg_autovacuum tuple is found for this
+ table, these settings are applied; otherwise the global values in
+ postgresql.conf are used. See
+ for more details on the global settings.
+
+
+ For each table, two conditions are used to determine which operation to
+ apply. If the number of obsolete tuples since the last
+ VACUUM exceeds the vacuum threshold
, the
+ table is vacuumed and analyzed. The vacuum threshold is defined as:
+vacuum threshold = vacuum base threshold + vacuum scale factor * number of tuples
+
+ where the vacuum base threshold is
+ pg_autovacuum.vac_base_thresh,
+ the vacuum scale factor is
+ pg_autovacuum.vac_scale_factor
+ and the number of tuples is
+ pg_class.reltuples.
+ The number of obsolete tuples is taken from the statistics
+ collector, which is a semi-accurate count updated by each
+ UPDATE and DELETE operation. (It
+ is only semi-accurate because some information may be lost under heavy
+ load.) For analyze, a similar condition is used: the threshold, calculated
+ by an equivalent equation to that above, is compared to the number of
+ new tuples, that is, those created by the INSERT and
+ COPY commands.
+
+
+ Note that if any of the values in pg_autovacuum
+ is set to a negative number, or if a tuple is not present at all in
+ pg_autovacuum for any particular table, the
+ equivalent value from postgresql.conf is used.
+
+
+ Besides the base threshold values and scale factors, there are three
+ parameters that can be set for each table in pg_autovacuum:
+ the vacuum cost delay
+ (pg_autovacuum.vac_cost_delay)
+ and the vacuum cost limit
+ (pg_autovacuum.vac_cost_limit).
+ They are used to set table-specific values for the
+
+ feature. The above note about negative values also applies here, but
+ also note that if the postgresql.conf variables
+ autovacuum_vacuum_cost_limit and
+ autovacuum_vacuum_cost_delay are also set to negative
+ values, the vacuum_cost_limit and
+ vacuum_cost_delay values will be used instead.
+ The other parameter, pg_autovacuum>.enabled>,
+ can be used to instruct the autovacuum daemon to skip any particular table
+ by setting it to false.
+
+
+