Re: Infinite Autovacuum loop caused by failing virtual generated column expression - Mailing list pgsql-hackers

From Yugo Nagata
Subject Re: Infinite Autovacuum loop caused by failing virtual generated column expression
Date
Msg-id 20260414152425.879493d6202956e23afeae03@sraoss.co.jp
Whole thread Raw
In response to Re: Infinite Autovacuum loop caused by failing virtual generated column expression  (Dean Rasheed <dean.a.rasheed@gmail.com>)
Responses Re: Infinite Autovacuum loop caused by failing virtual generated column expression
List pgsql-hackers
On Sat, 11 Apr 2026 17:33:13 +0100
Dean Rasheed <dean.a.rasheed@gmail.com> wrote:

> On Fri, 10 Apr 2026 at 21:19, SATYANARAYANA NARLAPURAM
> <satyanarlapuram@gmail.com> wrote:
> >
> > PG19 added support for stats on virtual generated columns [1]. Creating extended statistics on a virtual generated
columnwhose expression can raise an error leads to ANALYZE failing repeatedly, and autovacuum retrying indefinitely.
Thisfloods the server logs and also wastes resources. Vacuum analyze on that column (without extended stats) succeeds.
 
> >
> 
> True, though this is nothing new. The same thing can happen with
> expression statistics on an expression that raises an error, which has
> been possible since PG14.

Yes, this issue is not new, and I’m not aware of a way to prevent it a priori.

> 
> > In order to avoid retry storms, I think we have two options. (1) skipping the offending row from the sample, (2)
skippingthe extended stats computation for that table with a warning message. At least this avoid autovacuum infinite
retry.Attached a draft patch for the option (2). Thoughts?
 
> >
> 
> I'm not sure. The default retry interval is 1 minute, so it won't
> exactly be a flood of messages. Also, if the error only occurs for a
> small subset of rows, it's possible that retrying might succeed.

I think it would be good to skip ANALYZE for the extended statistics that cause
errors and just emit a warning, rather than aborting ANALYZE for the entire table.
It seems reasonable to treat this as the user’s responsibility to notice the warning
and address the underlying issue.

Regards,
Yugo Nagata

-- 
Yugo Nagata <nagata@sraoss.co.jp>



pgsql-hackers by date:

Previous
From: Chao Li
Date:
Subject: Re: Improve logical replication usability when tables lack primary keys
Next
From: Chao Li
Date:
Subject: Re: Bug: Rule actions see wrong values for generated columns (NEW.gen reads OLD value)