Re: Autovacuum not running properly

From: Rajesh Kumar <rajeshkumar(dot)dba09(at)gmail(dot)com>
To: Luca Ferrari <fluca1978(at)gmail(dot)com>
Cc: Pgsql-admin <pgsql-admin(at)lists(dot)postgresql(dot)org>
Subject: Re: Autovacuum not running properly
Date: 2023-09-04 11:43:56
Message-ID: CAJk5AtZDKDdNVtAjJXUzqfA=TXThVFcc7ZvQjwxi_C=HCensCA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

The result I get "amount of tuples inserted" is not very clear. Let's say I
get 10000 which is 10k , in this case, do you mean autovacuum will trigger
for every 10k (inserts+updates+deletes) ?

On Mon, 4 Sep, 2023, 1:56 PM Luca Ferrari, <fluca1978(at)gmail(dot)com> wrote:

> On Fri, Sep 1, 2023 at 6:32 PM Rajesh Kumar <rajeshkumar(dot)dba09(at)gmail(dot)com>
> wrote:
> >
> > In that case how to be sure of autovacuum is not necessary for this
> table? On what basis? Do we have any calculation
>
> The idea should be the number of "manipulated tuples" exceed the
> thresholds. For example, in the case of insert workload, something
> like:
>
> SELECT current_setting( 'autovacuum_vacuum_insert_threshold' )::numeric
> + current_setting( 'autovacuum_vacuum_insert_scale_factor' )::numeric
> * reltuples
> FROM pg_class
> WHERE relname = <your relation> and relkind = 'r';
>
> will give you the amount of tuples that, once inserted, will trigger
> an autovacuum. Therefore, unless your table receive more tuples than
> the above, autovacuum will not consider vacuuming the table (thn
> there's autoanalyze, that is another story but the reasoning is
> similar).
>
> Long story short: if your table is pretty much static, than it is
> clear that autovacuum is not goint to vacuum over an over the same
> data.
>
> Luca
>

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Luca Ferrari 2023-09-04 14:40:31 Re: Autovacuum not running properly
Previous Message Luca Ferrari 2023-09-04 08:30:08 Re: Why isn't there a IF NOT EXISTS clause on constraint creation?