| Server IP : 172.67.134.114 / Your IP : 162.159.115.42 Web Server : Apache/2.4.37 System : Linux almalinux.duckdns.org 4.18.0-553.111.1.el8_10.x86_64 #1 SMP Sun Mar 8 20:06:07 EDT 2026 x86_64 User : ricodeal ( 1046) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/share/doc/postgresql-docs/html/ |
Upload File : |
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>19.10. Automatic Vacuuming</title><link rel="stylesheet" type="text/css" href="stylesheet.css" /><link rev="made" href="[email protected]" /><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot" /><link rel="prev" href="runtime-config-statistics.html" title="19.9. Run-time Statistics" /><link rel="next" href="runtime-config-client.html" title="19.11. Client Connection Defaults" /></head><body><div xmlns="http://www.w3.org/TR/xhtml1/transitional" class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center">19.10. Automatic Vacuuming</th></tr><tr><td width="10%" align="left"><a accesskey="p" href="runtime-config-statistics.html" title="19.9. Run-time Statistics">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="runtime-config.html" title="Chapter 19. Server Configuration">Up</a></td><th width="60%" align="center">Chapter 19. Server Configuration</th><td width="10%" align="right"><a accesskey="h" href="index.html" title="PostgreSQL 10.23 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="runtime-config-client.html" title="19.11. Client Connection Defaults">Next</a></td></tr></table><hr></hr></div><div class="sect1" id="RUNTIME-CONFIG-AUTOVACUUM"><div class="titlepage"><div><div><h2 class="title" style="clear: both">19.10. Automatic Vacuuming</h2></div></div></div><a id="id-1.6.6.13.2" class="indexterm"></a><p> These settings control the behavior of the <em class="firstterm">autovacuum</em>
feature. Refer to <a class="xref" href="routine-vacuuming.html#AUTOVACUUM" title="24.1.6. The Autovacuum Daemon">Section 24.1.6</a> for more information.
Note that many of these settings can be overridden on a per-table
basis; see <a class="xref" href="sql-createtable.html#SQL-CREATETABLE-STORAGE-PARAMETERS" title="Storage Parameters">Storage Parameters</a>.
</p><div class="variablelist"><dl class="variablelist"><dt id="GUC-AUTOVACUUM"><span class="term"><code class="varname">autovacuum</code> (<code class="type">boolean</code>)
<a id="id-1.6.6.13.4.1.1.3" class="indexterm"></a>
</span></dt><dd><p> Controls whether the server should run the
autovacuum launcher daemon. This is on by default; however,
<a class="xref" href="runtime-config-statistics.html#GUC-TRACK-COUNTS">track_counts</a> must also be enabled for
autovacuum to work.
This parameter can only be set in the <code class="filename">postgresql.conf</code>
file or on the server command line; however, autovacuuming can be
disabled for individual tables by changing table storage parameters.
</p><p> Note that even when this parameter is disabled, the system
will launch autovacuum processes if necessary to
prevent transaction ID wraparound. See <a class="xref" href="routine-vacuuming.html#VACUUM-FOR-WRAPAROUND" title="24.1.5. Preventing Transaction ID Wraparound Failures">Section 24.1.5</a> for more information.
</p></dd><dt id="GUC-LOG-AUTOVACUUM-MIN-DURATION"><span class="term"><code class="varname">log_autovacuum_min_duration</code> (<code class="type">integer</code>)
<a id="id-1.6.6.13.4.2.1.3" class="indexterm"></a>
</span></dt><dd><p> Causes each action executed by autovacuum to be logged if it ran for at
least the specified number of milliseconds. Setting this to zero logs
all autovacuum actions. Minus-one (the default) disables logging
autovacuum actions. For example, if you set this to
<code class="literal">250ms</code> then all automatic vacuums and analyzes that run
250ms or longer will be logged. In addition, when this parameter is
set to any value other than <code class="literal">-1</code>, a message will be
logged if an autovacuum action is skipped due to the existence of a
conflicting lock. Enabling this parameter can be helpful
in tracking autovacuum activity. This parameter can only be set in
the <code class="filename">postgresql.conf</code> file or on the server command line;
but the setting can be overridden for individual tables by
changing table storage parameters.
</p></dd><dt id="GUC-AUTOVACUUM-MAX-WORKERS"><span class="term"><code class="varname">autovacuum_max_workers</code> (<code class="type">integer</code>)
<a id="id-1.6.6.13.4.3.1.3" class="indexterm"></a>
</span></dt><dd><p> Specifies the maximum number of autovacuum processes (other than the
autovacuum launcher) that may be running at any one time. The default
is three. This parameter can only be set at server start.
</p></dd><dt id="GUC-AUTOVACUUM-NAPTIME"><span class="term"><code class="varname">autovacuum_naptime</code> (<code class="type">integer</code>)
<a id="id-1.6.6.13.4.4.1.3" class="indexterm"></a>
</span></dt><dd><p> Specifies the minimum delay between autovacuum runs on any given
database. In each round the daemon examines the
database and issues <code class="command">VACUUM</code> and <code class="command">ANALYZE</code> commands
as needed for tables in that database. The delay is measured
in seconds, and the default is one minute (<code class="literal">1min</code>).
This parameter can only be set in the <code class="filename">postgresql.conf</code>
file or on the server command line.
</p></dd><dt id="GUC-AUTOVACUUM-VACUUM-THRESHOLD"><span class="term"><code class="varname">autovacuum_vacuum_threshold</code> (<code class="type">integer</code>)
<a id="id-1.6.6.13.4.5.1.3" class="indexterm"></a>
</span></dt><dd><p> Specifies the minimum number of updated or deleted tuples needed
to trigger a <code class="command">VACUUM</code> in any one table.
The default is 50 tuples.
This parameter can only be set in the <code class="filename">postgresql.conf</code>
file or on the server command line;
but the setting can be overridden for individual tables by
changing table storage parameters.
</p></dd><dt id="GUC-AUTOVACUUM-ANALYZE-THRESHOLD"><span class="term"><code class="varname">autovacuum_analyze_threshold</code> (<code class="type">integer</code>)
<a id="id-1.6.6.13.4.6.1.3" class="indexterm"></a>
</span></dt><dd><p> Specifies the minimum number of inserted, updated or deleted tuples
needed to trigger an <code class="command">ANALYZE</code> in any one table.
The default is 50 tuples.
This parameter can only be set in the <code class="filename">postgresql.conf</code>
file or on the server command line;
but the setting can be overridden for individual tables by
changing table storage parameters.
</p></dd><dt id="GUC-AUTOVACUUM-VACUUM-SCALE-FACTOR"><span class="term"><code class="varname">autovacuum_vacuum_scale_factor</code> (<code class="type">floating point</code>)
<a id="id-1.6.6.13.4.7.1.3" class="indexterm"></a>
</span></dt><dd><p> Specifies a fraction of the table size to add to
<code class="varname">autovacuum_vacuum_threshold</code>
when deciding whether to trigger a <code class="command">VACUUM</code>.
The default is 0.2 (20% of table size).
This parameter can only be set in the <code class="filename">postgresql.conf</code>
file or on the server command line;
but the setting can be overridden for individual tables by
changing table storage parameters.
</p></dd><dt id="GUC-AUTOVACUUM-ANALYZE-SCALE-FACTOR"><span class="term"><code class="varname">autovacuum_analyze_scale_factor</code> (<code class="type">floating point</code>)
<a id="id-1.6.6.13.4.8.1.3" class="indexterm"></a>
</span></dt><dd><p> Specifies a fraction of the table size to add to
<code class="varname">autovacuum_analyze_threshold</code>
when deciding whether to trigger an <code class="command">ANALYZE</code>.
The default is 0.1 (10% of table size).
This parameter can only be set in the <code class="filename">postgresql.conf</code>
file or on the server command line;
but the setting can be overridden for individual tables by
changing table storage parameters.
</p></dd><dt id="GUC-AUTOVACUUM-FREEZE-MAX-AGE"><span class="term"><code class="varname">autovacuum_freeze_max_age</code> (<code class="type">integer</code>)
<a id="id-1.6.6.13.4.9.1.3" class="indexterm"></a>
</span></dt><dd><p> Specifies the maximum age (in transactions) that a table's
<code class="structname">pg_class</code>.<code class="structfield">relfrozenxid</code> field can
attain before a <code class="command">VACUUM</code> operation is forced
to prevent transaction ID wraparound within the table.
Note that the system will launch autovacuum processes to
prevent wraparound even when autovacuum is otherwise disabled.
</p><p> Vacuum also allows removal of old files from the
<code class="filename">pg_xact</code> subdirectory, which is why the default
is a relatively low 200 million transactions.
This parameter can only be set at server start, but the setting
can be reduced for individual tables by
changing table storage parameters.
For more information see <a class="xref" href="routine-vacuuming.html#VACUUM-FOR-WRAPAROUND" title="24.1.5. Preventing Transaction ID Wraparound Failures">Section 24.1.5</a>.
</p></dd><dt id="GUC-AUTOVACUUM-MULTIXACT-FREEZE-MAX-AGE"><span class="term"><code class="varname">autovacuum_multixact_freeze_max_age</code> (<code class="type">integer</code>)
<a id="id-1.6.6.13.4.10.1.3" class="indexterm"></a>
</span></dt><dd><p> Specifies the maximum age (in multixacts) that a table's
<code class="structname">pg_class</code>.<code class="structfield">relminmxid</code> field can
attain before a <code class="command">VACUUM</code> operation is forced to
prevent multixact ID wraparound within the table.
Note that the system will launch autovacuum processes to
prevent wraparound even when autovacuum is otherwise disabled.
</p><p> Vacuuming multixacts also allows removal of old files from the
<code class="filename">pg_multixact/members</code> and <code class="filename">pg_multixact/offsets</code>
subdirectories, which is why the default is a relatively low
400 million multixacts.
This parameter can only be set at server start, but the setting can
be reduced for individual tables by changing table storage parameters.
For more information see <a class="xref" href="routine-vacuuming.html#VACUUM-FOR-MULTIXACT-WRAPAROUND" title="24.1.5.1. Multixacts and Wraparound">Section 24.1.5.1</a>.
</p></dd><dt id="GUC-AUTOVACUUM-VACUUM-COST-DELAY"><span class="term"><code class="varname">autovacuum_vacuum_cost_delay</code> (<code class="type">integer</code>)
<a id="id-1.6.6.13.4.11.1.3" class="indexterm"></a>
</span></dt><dd><p> Specifies the cost delay value that will be used in automatic
<code class="command">VACUUM</code> operations. If -1 is specified, the regular
<a class="xref" href="runtime-config-resource.html#GUC-VACUUM-COST-DELAY">vacuum_cost_delay</a> value will be used.
The default value is 20 milliseconds.
This parameter can only be set in the <code class="filename">postgresql.conf</code>
file or on the server command line;
but the setting can be overridden for individual tables by
changing table storage parameters.
</p></dd><dt id="GUC-AUTOVACUUM-VACUUM-COST-LIMIT"><span class="term"><code class="varname">autovacuum_vacuum_cost_limit</code> (<code class="type">integer</code>)
<a id="id-1.6.6.13.4.12.1.3" class="indexterm"></a>
</span></dt><dd><p> Specifies the cost limit value that will be used in automatic
<code class="command">VACUUM</code> operations. If -1 is specified (which is the
default), the regular
<a class="xref" href="runtime-config-resource.html#GUC-VACUUM-COST-LIMIT">vacuum_cost_limit</a> value will be used. Note that
the value is distributed proportionally among the running autovacuum
workers, if there is more than one, so that the sum of the limits for
each worker does not exceed the value of this variable.
This parameter can only be set in the <code class="filename">postgresql.conf</code>
file or on the server command line;
but the setting can be overridden for individual tables by
changing table storage parameters.
</p></dd></dl></div></div><div xmlns="http://www.w3.org/TR/xhtml1/transitional" class="navfooter"><hr></hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="runtime-config-statistics.html" title="19.9. Run-time Statistics">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="runtime-config.html" title="Chapter 19. Server Configuration">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="runtime-config-client.html" title="19.11. Client Connection Defaults">Next</a></td></tr><tr><td width="40%" align="left" valign="top">19.9. Run-time Statistics </td><td width="20%" align="center"><a accesskey="h" href="index.html" title="PostgreSQL 10.23 Documentation">Home</a></td><td width="40%" align="right" valign="top"> 19.11. Client Connection Defaults</td></tr></table></div></body></html>