Re: pg_stat_get_autovacuum_scores ignores the main table's reloptions for TOAST tables

From: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>
To: Nathan Bossart <nathandbossart(at)gmail(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_stat_get_autovacuum_scores ignores the main table's reloptions for TOAST tables
Date: 2026-08-28 19:15:02
Message-ID: CAD21AoD-Upg0APV4oKvzznB8c4ELbZ-VfZZeumDfkP2+suZ6hA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Aug 28, 2026 at 11:50 AM Nathan Bossart
<nathandbossart(at)gmail(dot)com> wrote:
>
> On Fri, Aug 28, 2026 at 11:12:34AM -0700, Masahiko Sawada wrote:
> > Thank you for making the patch quickly! The patch looks good to me. A nitpick:
>
> Thanks for reviewing.
>
> > + if (found && hentry->ar_hasrelopts)
> > + avopts = &hentry->ar_reloptions;
> >
> > ar_hasrelopts is always true here, since entries are only created when
> > extract_autovac_opts() returns non-NULL, so the second conjunct is
> > redundant actually. Having said that, it seems safer for future
> > changes and keeping it for symmetry with do_autovacuum() seems fine to
> > me.
>
> Yeah, this is about what I was thinking.
>
> > Do we want to have regression tests for it? FWIW no test exercises
> > pg_stat_get_autovacuum_scores(). The only reference in the tree is the
> > view definition in rules.out. That's presumably why this went
> > unnoticed.
>
> It might be worth adding a test or two for this view, but I doubt it
> would've caught this issue. IIRC I held off adding tests originally
> because I was worried about test stability.

Setting autovacuum_enabled = off to the tables while checking
pg_stat_get_autovacuum_scores() would help the test stability. Adding
regression tests to the view would be a separate topic so I think we
can fix the issue by your patch separately from the regression tests.

Regards,

--
Masahiko Sawada
Amazon Web Services: https://aws.amazon.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Antonin Houska 2026-08-28 19:15:25 Re: REPACK (ANALYZE) within transaction block segfaults
Previous Message Masahiko Sawada 2026-08-28 19:11:10 Re: timeout value overflow in wait for lsn