Re: Add pg_stat_autovacuum_priority

From: Sami Imseih <samimseih(at)gmail(dot)com>
To: Nathan Bossart <nathandbossart(at)gmail(dot)com>
Cc: Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>, Robert Treat <rob(at)xzilla(dot)net>, satyanarlapuram(at)gmail(dot)com, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Add pg_stat_autovacuum_priority
Date: 2026-04-01 23:04:36
Message-ID: CAA5RZ0uVg0L3vVvkOiHaY9ZJ+K9ZcsyQH0TVQ5rXSd-ZEeVFNg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> I've been thinking about whether to also return whether autovacuum is
> enabled in the view, i.e., AutoVacuumingActive() && av_enabled.

I don't think we can rely on AutoVacuumingActive() being stable since a
backend that does a SET track_counts = off for whatever reason and
then calls the view will get false. av_enabled will likely be the only
thing we can report.

> So, I'm
> currently leaning towards leaving that information out for now.

I agree.

>
> scores->needs_vacuum = (vactuples > vacthresh);
> *do_vacuum |= (av_enabled && scores->needs_vacuum);
>
> ... but others might find your version easier to read.

yeah, for readability, I'll stick with the current.

> Otherwise, 0001 looks good.
>
> In 0003, I think you missed renaming the last argument to
> compute_autovac_score() in table_recheck_autovac().

Earlier, I did not compile with 0003 only. Fixed.

> I didn't see anything else in this read-through. I'm planning to start
> preparing this for commit tomorrow.

Thanks! here is v7

--
Sami

Attachment Content-Type Size
v7-0002-Add-elevel-parameter-to-relation_needs_vacanalyze.patch application/octet-stream 4.5 KB
v7-0004-Add-pg_stat_autovacuum_priority-view.patch application/octet-stream 18.4 KB
v7-0001-Always-compute-autovacuum-priority-scores.patch application/octet-stream 10.3 KB
v7-0003-Refactor-autovacuum-score-computation-into-comput.patch application/octet-stream 4.2 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Jackson 2026-04-01 23:07:47 Re: Add ldapservice connection parameter
Previous Message Daniel Gustafsson 2026-04-01 23:01:49 Re: Changing the state of data checksums in a running cluster