Increase the default vacuum_cost_limit from 200 to 2000
authorAndrew Dunstan <[email protected]>
Wed, 6 Mar 2019 14:10:12 +0000 (09:10 -0500)
committerAndrew Dunstan <[email protected]>
Wed, 6 Mar 2019 14:10:12 +0000 (09:10 -0500)
The original 200 default value was set back in f425b605f4e when the cost
delay settings were first added.  Hardware has improved quite a bit since
then and we've also made improvements such as sorting buffers during
checkpoints (9cd00c457e6) which should result in less random writes.

This low default value was reportedly causing problems with badly
configured servers and in the absence of a native method to remove
excessive bloat from tables without incurring an AccessExclusiveLock, this
often made cleaning up the damage caused by badly configured auto-vacuums
difficult.

It seems more likely that someone will notice that auto-vacuum is running
too quickly than too slowly, so let's go all out and multiple the default
value for the setting by 10.  With the default vacuum_cost_page_dirty and
autovacuum_vacuum_cost_delay (assuming a page size of 8192 bytes), this
allows autovacuum a theoretical maximum dirty write rate of around 39MB/s
instead of just 3.9MB/s.

Author: David Rowley

Discussion: https://postgr.es/m/CAKJS1f_YbXC2qTMPyCbmsPiKvZYwpuQNQMohiRXLj1r=8_rYvw@mail.gmail.com

doc/src/sgml/config.sgml
src/backend/utils/init/globals.c
src/backend/utils/misc/guc.c
src/backend/utils/misc/postgresql.conf.sample

index 6d42b7afe732311aea4dbce3fa56d726398484d3..7bbe8f590b6f222fd11723a21446fd1d42965830 100644 (file)
@@ -1929,7 +1929,7 @@ include_dir 'conf.d'
        <listitem>
         <para>
          The accumulated cost that will cause the vacuuming process to sleep.
-         The default value is 200.
+         The default value is 2000.
         </para>
        </listitem>
       </varlistentry>
index fd51934aaf133fd40aad29c35131f2880575d8c3..a6ce184537261fdfbcacb028fc9f78abd286b5ed 100644 (file)
@@ -137,7 +137,7 @@ int         MaxBackends = 0;
 int            VacuumCostPageHit = 1;  /* GUC parameters for vacuum */
 int            VacuumCostPageMiss = 10;
 int            VacuumCostPageDirty = 20;
-int            VacuumCostLimit = 200;
+int            VacuumCostLimit = 2000;
 int            VacuumCostDelay = 0;
 
 int            VacuumPageHit = 0;
index 156d147c85be8377374214c22f9195f403bb237d..826c189a9670da3705059e0ecd4460262893e8ae 100644 (file)
@@ -2268,7 +2268,7 @@ static struct config_int ConfigureNamesInt[] =
            NULL
        },
        &VacuumCostLimit,
-       200, 1, 10000,
+       2000, 1, 10000,
        NULL, NULL, NULL
    },
 
index bd6ea65d0c81558e9265cc705cd591fc3fa7a480..99f1666eef9052cca490cf3a80f2d92222fa00fa 100644 (file)
 #vacuum_cost_page_hit = 1      # 0-10000 credits
 #vacuum_cost_page_miss = 10        # 0-10000 credits
 #vacuum_cost_page_dirty = 20       # 0-10000 credits
-#vacuum_cost_limit = 200       # 1-10000 credits
+#vacuum_cost_limit = 2000      # 1-10000 credits
 
 # - Background Writer -