-- Find current setting (this is at database level)
select * from pg_settings where name in ('autovacuum','autovacuum_analyze_scale_factor','autovacuum_analyze_threshold','autovacuum_vacuum_scale_factor');
select current_setting('autovacuum_vacuum_scale_factor') as "analyze_scale_factor",current_setting('autovacuum_vacuum_threshold') as "vacuum_threshold";
select current_setting('autovacuum_analyze_scale_factor') as "analyze_scale_factor", current_setting('autovacuum_analyze_threshold') as "analyze_threshold";
-- Note: The smaller number = more aggressive = vacuum more frequence
-- autovacuum_analyze_scale_factor = 0.05
-- autovacuum_vacuum_scale_factor = 0.1
-- Fine Tune at table level = ALTER TABLE mytable SET (autovacuum_analyze_scale_factor = 0.02);
ALTER TABLE your_schema.your_table SET (autovacuum_enabled = true,autovacuum_analyze_scale_factor = 0.002,autovacuum_vacuum_scale_factor = 0.001);
-- Put it back to use global setting
ALTER TABLE your_schema.your_table RESET (autovacuum_enabled,autovacuum_analyze_scale_factor,autovacuum_vacuum_scale_factor);
Why Autovacuum is not running on specific tables while it works on other tables and how to resolve this.
And for some tables the last autovacuum done is 2days ago whereas most are till today.
How to analyze autovacuum and take action?
Thanks a lot. I will check
On Mon, 28 Aug 2023, 19:13 Wetmore, Matthew (CTR), <Matthew.Wetmore@xxxxxxxxxxxxxxxxxxx> wrote: