Database Autovacuum Tuning
by Camptocamp https://github.com/OCA/server-tools , Odoo Community Association (OCA) https://github.com/OCA/server-tools| Availability |
Odoo Online
Odoo.sh
On Premise
|
| Lines of code | 154 |
| Technical Name |
database_autovacuum_tuning |
| License | LGPL-3 |
| Website | https://github.com/OCA/server-tools |
Database Autovacuum Tuning

Database Autovacuum Tuning helps administrators keep PostgreSQL healthy by exposing recommended autovacuum settings in Odoo. It provides guidance and documentation for sizing thresholds and scale factors so large, busy databases avoid table bloat and excessive vacuum lag. Use it to standardize autovacuum configuration across environments and speed up maintenance operations without manual tuning.
This module is mostly useful for PostgreSQL <= 17. PostgreSQL 18.0 introduces the autovacuum_vacuum_max_threshold parameter, which already provides the capability this module targets.
The pgstattuple extension must be installed on the database.
Important
This is an alpha version, the data model and design can change at any time without warning. Only for development or testing purpose, do not use in production. More details on development status
Table of contents
Usage
Install the module on the database you want to tune.
Go to Settings > Technical > Database Structure > Database Autovacuum Tuning and review the recommended thresholds and scale factors.
If needed, override the defaults using the following system parameters:
- database_autovacuum_tuning.autovacuum_vacuum_max_threshold
- database_autovacuum_tuning.autovacuum_vacuum_analyze_max_threshold
The configuration parameters are applied to tables by the daily cron job. When the number of dead tuples in a table exceeds the vacuum threshold, it applies the following configuration:
ALTER TABLE {schemaname}.{tablename} SET ( autovacuum_vacuum_scale_factor = 0, autovacuum_vacuum_threshold = %s, autovacuum_analyze_scale_factor = 0, autovacuum_analyze_threshold = %s )
Monitor vacuum activity and table bloat, then adjust the settings if your workload changes.
Bug Tracker
Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us to smash it by providing a detailed and welcomed feedback.
Do not contact contributors directly about support or help with technical issues.
Credits
Authors
- Camptocamp
Contributors
- Telmo Santos <telmo.santos@camptocamp.com>
- Alexandre Fayolle <alexandre.fayolle@camptocamp.com>
Maintainers
This module is maintained by the OCA.
OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.
This module is part of the OCA/server-tools project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
Please log in to comment on this module