From: Wetmore, Matthew (CTR) <Matthew.Wetmore@express-scripts.com>
To: Rajesh Kumar <rajeshkumar.dba09@gmail.com>
To: pgsql-admin@lists.postgresql.org <pgsql-admin@lists.postgresql.org>
Subject: Autovacuum not running properly
Date: Mon, 28 Aug 2023 13:43:55 +0000
Message-ID: <2dce7c15ef3244ee8d5426dc0579d5c8@express-scripts.com> (raw)
In-Reply-To: <CAJk5AtZ_X4Ho2ZAV5-cQ+u1GhQgnO6NHt61J7C8WHMj83Lbhog@mail.gmail.com>
References: <CAJk5AtZ_X4Ho2ZAV5-cQ+u1GhQgnO6NHt61J7C8WHMj83Lbhog@mail.gmail.com>
-- 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
-- Current:
-- 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);
From: Rajesh Kumar <rajeshkumar.dba09@gmail.com>
Sent: Sunday, August 27, 2023 4:09 AM
To: pgsql-admin@lists.postgresql.org
Subject: [EXTERNAL] Autovacuum not running properly
Hi
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?
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-admin@postgresql.org
Cc: Matthew.Wetmore@express-scripts.com, rajeshkumar.dba09@gmail.com, pgsql-admin@lists.postgresql.org
Subject: Re: Autovacuum not running properly
In-Reply-To: <2dce7c15ef3244ee8d5426dc0579d5c8@express-scripts.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox