Re: Trigger more frequent autovacuums

From: Melanie Plageman <melanieplageman(at)gmail(dot)com>
To: wenhui qiu <qiuwenhuifx(at)gmail(dot)com>
Cc: Nathan Bossart <nathandbossart(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Japin Li <japinli(at)hotmail(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>
Subject: Re: Trigger more frequent autovacuums
Date: 2025-03-07 15:47:59
Message-ID: CAAKRu_bSUQwg7CcUZ+V_ar_woA2EtOD8y1hFARCJOH8hTKTXRA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Mar 7, 2025 at 6:19 AM wenhui qiu <qiuwenhuifx(at)gmail(dot)com> wrote:
>
> Sorry ,A wrong version of debug pcnt_visibletuples ,kindly please check the v3 attachment

I looked at v3. I think I need more than the logging message to
understand your goal here. Could you explain the algorithm and why you
think it makes sense and what scenarios it is meant to handle better?

Thinking about it conceptually, I don't think this makes sense:

pcnt_visibletuples = (float4) (livetuples / (livetuples + vactuples));
vacthresh = (float4) vac_base_thresh + vac_scale_factor * reltuples *
pcnt_visibletuples
do_vacuum = vactuples > vacthresh

livetuples + deadtuples is approx reltuples (little more complicated
than this, but), so this is basically
livetuples/reltuples*reltuples -> livetuples

So vactuples > vacthresh is basically just deadtuples > livetuples

Maybe you think that we should be comparing the portion of the table
that is dead to the portion of the table that is live, but that
doesn't seem to be what you mean the algorithm to do based on the one
comment you have.

The anlthresh calculation is a different discussion, since
mod_since_analyze is calculated in a different way (tuples updated +
tuples inserted + tuples_deleted). But I am also skeptical of this
one.

I think you need to explain more conceptually about why you think
these ways of calculating the thresholds makes sense.

- Melanie

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2025-03-07 15:49:44 Re: Refactoring postmaster's code to cleanup after child exit
Previous Message Alexander Korotkov 2025-03-07 15:47:08 pg_atomic_compare_exchange_*() and memory barriers