Document the new autovacuum daemon.
authorAlvaro Herrera
Tue, 13 Sep 2005 01:51:18 +0000 (01:51 +0000)
committerAlvaro Herrera
Tue, 13 Sep 2005 01:51:18 +0000 (01:51 +0000)
doc/src/sgml/catalogs.sgml
doc/src/sgml/config.sgml
doc/src/sgml/maintenance.sgml

index c813ba98ded7874de4cb802f2da6144c6f964975..445f359f22129eb7ca9e5acc796861c138b1ebbf 100644 (file)
@@ -1,6 +1,6 @@
 
 
 
    pg_autovacuum
   
 
+  
+   autovacuum
+   table-specific configuration
+  
+
   
    The catalog pg_autovacuum stores optional
-   per-relation configuration parameters for <quote>autovacuum>.
+   per-relation configuration parameters for <xref linkend="autovacuum" endterm="autovacuum-title">.
    If there is an entry here for a particular relation, the given
    parameters will be used for autovacuuming that table.  If no entry
    is present, the system-wide defaults will be used.
index dea655b67e7c4f3717022a1b6a42315b0ed8649c..4d65dd6b8054b0d1986ff30944c3fc14499209a2 100644 (file)
@@ -1,5 +1,5 @@
 
 
   Run-time Configuration
@@ -2897,18 +2897,15 @@ SELECT * FROM parent WHERE key = 2400;
    
     Automatic Vacuuming
 
+    
+     autovacuum
+     global configuration parameters
+    
+
      
-      Beginning in PostgreSQL 8.1, there is an optional server
-      process called the autovacuum daemon, whose purpose is
-      to automate the issuance of periodic VACUUM and
-      ANALYZE commands.  When enabled, the autovacuum daemon
-      runs periodically and checks for tables that have had a large number
-      of updated or deleted tuples.  This check uses the row-level statistics
-      collection facility; therefore, the autovacuum daemon cannot be used
-      unless  and
-       are set TRUE.  Also, it's
-      important to allow a slot for the autovacuum process when choosing
-      the value of .
+      These settings control the default behavior for the autovacuum
+      daemon. Please refer to  for
+      more information.
      
 
     
@@ -2958,6 +2955,8 @@ SELECT * FROM parent WHERE key = 2400;
         The default is 1000.
         This option can only be set at server start or in the
         postgresql.conf file.
+        This setting can be overridden for individual tables by entries in
+        pg_autovacuum.
        
       
      
@@ -2974,6 +2973,8 @@ SELECT * FROM parent WHERE key = 2400;
         The default is 500.
         This option can only be set at server start or in the
         postgresql.conf file.
+        This setting can be overridden for individual tables by entries in
+        pg_autovacuum.
        
       
      
@@ -2991,6 +2992,8 @@ SELECT * FROM parent WHERE key = 2400;
         The default is 0.4.
         This option can only be set at server start or in the
         postgresql.conf file.
+        This setting can be overridden for individual tables by entries in
+        pg_autovacuum.
        
       
      
@@ -3008,6 +3011,8 @@ SELECT * FROM parent WHERE key = 2400;
         The default is 0.2.
         This option can only be set at server start or in the
         postgresql.conf file.
+        This setting can be overridden for individual tables by entries in
+        pg_autovacuum.
        
       
      
index b9ce518554b78e0b339c4acbfbdf7c47228b6e65..d4b3f51d557085239a1400c43a26da6bff835228 100644 (file)
@@ -1,5 +1,5 @@
 
 
 
@@ -99,6 +99,12 @@ $PostgreSQL: pgsql/doc/src/sgml/maintenance.sgml,v 1.45 2005/06/22 21:14:28 tgl
    .
   
 
+  
+   An automated mechanism for performing the necessary VACUUM
+   operations has been added in PostgreSQL 8.1.
+   See .
+  
+
   
    Recovering disk space
 
@@ -177,13 +183,6 @@ $PostgreSQL: pgsql/doc/src/sgml/maintenance.sgml,v 1.45 2005/06/22 21:14:28 tgl
     the program vacuumdb may be helpful.
    
 
-   
-    
-     The contrib/pg_autovacuum program can be useful for
-     automating high-frequency vacuuming operations.
-    
-   
-
    
     VACUUM FULL is recommended for cases where you know
     you have deleted the majority of rows in a table, so that the
@@ -456,6 +455,98 @@ HINT:  Stop the postmaster and use a standalone backend to VACUUM in "mydb".
     
    
   
+
+  
+   The auto-vacuum daemon
+
+   
+    autovacuum
+    general information
+   
+   
+    Beginning in PostgreSQL  8.1, there is a
+    separate optional server process called the autovacuum
+    daemon, whose purpose is to automate the issuance of
+    VACUUM and ANALYZE  commands.
+    When enabled, the autovacuum daemon runs periodically and checks for
+    tables that have had a large number of inserted, updated or deleted
+    tuples.  These checks use the row-level statistics collection facility;
+    therefore, the autovacuum daemon cannot be used unless 
+    linkend="guc-stats-start-collector"> and 
+    linkend="guc-stats-row-level"> are set true.  Also, it's
+    important to allow a slot for the autovacuum process when choosing the
+    value of .
+   
+
+   
+    The autovacuum daemon, when enabled, runs every 
+    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.
+   
+
+