Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wCY15-0025y5-1t for pgsql-hackers@arkaria.postgresql.org; Tue, 14 Apr 2026 07:17:00 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wCY12-00ARFZ-1X for pgsql-hackers@arkaria.postgresql.org; Tue, 14 Apr 2026 07:16:57 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wCY12-00ARFR-0F for pgsql-hackers@lists.postgresql.org; Tue, 14 Apr 2026 07:16:57 +0000 Received: from mail-vs1-xe2c.google.com ([2607:f8b0:4864:20::e2c]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wCY10-00000000vwo-3Kit for pgsql-hackers@lists.postgresql.org; Tue, 14 Apr 2026 07:16:56 +0000 Received: by mail-vs1-xe2c.google.com with SMTP id ada2fe7eead31-6108228a851so461619137.0 for ; Tue, 14 Apr 2026 00:16:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1776151014; cv=none; d=google.com; s=arc-20240605; b=gIK3/23rS57asMIXEh6hgtafov1wCIy/m5lhdEfVAvTEl8sXxaZ/GVp9gfBx7UMeBH B+xe0A9NYR+yIpJ7H09jyadyYR16UWyIYuw2NXpkjdAJWHfopi1J4A05LAgjdrHYe6ZV u2Yip84wJ6zFI5LzljumQObnlVk2yHPAOs22EZXWozL3fdXkVH85TQY3Rif5xYzN5+Kc 11vzNZKruQkkROQMphMEhLzel3hIOOeB2kFkYF+a5+9mLFbEWTpKXWbK/DmgdEGs1xe/ QxpwT4fjOB49yBv3sIMxUUoQf37AyItNnO6SGPcfzY/HRygTqnqz2havDXFcHsEihem4 I/6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:dkim-signature; bh=YUrsdHA3KCbELh7jiyusgyvHpExXE6ruZRHRxDoe2U8=; fh=EDjSvK2POaxt0E/7Zg3jEksIybg7Z207jmKLTiCdJK4=; b=W/r2ZcW8JkX1kEVHAhGtnrqyDkmNS43kbg+H/1DyxAqkCohCh+Xl4LGf3+vt1qtCDt mgCOkcXOZ2MbkQSZcBgdb1nMJ26Lz5eQNFUGzEq4GhcNFp4lbu2GFXbsHyBrowxG64vW wlpbJZvOeC2XVPFf8cIG8rDzQ47kK6HWfmpF1F8ijjN7WTi3brnohsS9vhZH99Ydkn5t lbJx7HWzbK8kv8TQqIUUyHXjPoJXDdP5yT60E7F5pjWQSBfu4n35HK4KwpOMPp2udfgj kHATpMOyl4Fj+zjWc1pFiwbIsE1+nT3hkiWzmjZGHl9LJzNAHWkT7U8nLR8v+dSKWaH0 j29A==; darn=lists.postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1776151014; x=1776755814; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=YUrsdHA3KCbELh7jiyusgyvHpExXE6ruZRHRxDoe2U8=; b=oM8F7oLbYM+y9boDJFmyxlm4CDF1Zb9j3aeplNS2XLaRRFedlajWZDavURO4cdcYxA OZxd9gDDqnht8mqmYi6SUsOcel4Ml53BOYAjBZYsDzmXf0UO3T82+8m1176qrVHX74sr wytc9OTnyeNDQYJu7GHHWa5/ybeXh2Ym9T/2Lv8sPPa+2yF1itltAkZWuDu+vpI75oPR mKa0E5TydFgielbG70trBWYIiCsS5STe1tKWc3Lju7LgjlMzEHjbESd8fAT9Ceunu78Y AlcH5jvHOca9IBnyUv+FbW2RJZXy7Ntz87d3b6Wf2z2Axpy7zGO9ipgPy7APAZtnWxAI NsEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776151014; x=1776755814; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=YUrsdHA3KCbELh7jiyusgyvHpExXE6ruZRHRxDoe2U8=; b=cYuA556rb75duL6wfGgEwsSPJ9oXARhrLIYYmL6sDlIaUvJsuzQngPgvZDUQTkD5HH hRYuN5V7lcSxQjSdtshG3IiC3ZMg+q2Li7a3P3l/WyskZtCez66+GlP5lYsf3AoRUBSn OuGAlzg7TuSchvx0IheWjsh3G4Jb2oqKi9ZN+xDLTiQDWH7hbtwbqkWvFDGXVNKJPdsJ femjrtyU7qmO0W4XUZfi0ZU5yzX9SwYtuliuciRZr3Xixy6AahsCkTjc4jwUCNZUVwXV 7uM+eyP/hYjOzzMYo5DIPFRA9Pf0ufsLFadAXOZf2nxUYRAUgY93CfqFMa6vb60D+/XS HlHA== X-Forwarded-Encrypted: i=1; AFNElJ+7oCd8npqNpLmLkT0ayU8cjvE9xkISTWgU1a9HbiLlkvLT8+GuAn/iltnhqsNPJtwiCQFoqGmvPVlXB7QB@lists.postgresql.org X-Gm-Message-State: AOJu0YydxSVc/XeqDe9kTSwFz1M9RqfNY0oEzcUjDczAvotblp7QKK5b NS1X3g1EGKLe6UJqsNQhgUv1nZJ0To9nkoGpGFKp31W5ghUSDbWVeLMNEW4Fu4pNx+8b4GnzVjB yBLJuhbEdV60wAHcFEOxc4uGAyeKIFNk= X-Gm-Gg: AeBDievah3JtfjjmFTWXf2r/Zk+D4OF72sRM3FrGP2pi3miZTNvJqi5LkEvT6x3DH9w o7es1gBWOnlslHn7WwwqFRPVG54CHz5oc68kkdHd/gKVUhYaw9ZppPTjkDiI1VhWeDW75EbFYyQ jhDJRFGf3SXSOUqlQ7r+n55lgrGMPlXW0ertczGZ8NwSqCbZUJt4IFFN3XlEbHvSEpwxYGqRleg MIV6mspKqZVYLYprCpN8iHbvrmdrYpT/QUVxMJxSKmJ6+DB8KN8yATQ/+2WT87k5yBQWkxC/gg1 7pJOKAIL4rVugRvsRRpH3Snu1PqE X-Received: by 2002:a05:6102:4a93:b0:60a:8515:9097 with SMTP id ada2fe7eead31-60a85159874mr6793019137.3.1776151013861; Tue, 14 Apr 2026 00:16:53 -0700 (PDT) MIME-Version: 1.0 References: <20260414152425.879493d6202956e23afeae03@sraoss.co.jp> In-Reply-To: <20260414152425.879493d6202956e23afeae03@sraoss.co.jp> From: SATYANARAYANA NARLAPURAM Date: Tue, 14 Apr 2026 00:16:42 -0700 X-Gm-Features: AQROBzAtE7WcAIoRK2-dBMN5iJ1A-kD6k2ms3ahZjp3IvwIuKmhMG-BzAnh7-Fk Message-ID: Subject: Re: Infinite Autovacuum loop caused by failing virtual generated column expression To: Yugo Nagata Cc: Dean Rasheed , PostgreSQL Hackers Content-Type: multipart/alternative; boundary="0000000000003faec2064f666203" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --0000000000003faec2064f666203 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi On Mon, Apr 13, 2026 at 11:24=E2=80=AFPM Yugo Nagata = wrote: > On Sat, 11 Apr 2026 17:33:13 +0100 > Dean Rasheed wrote: > > > On Fri, 10 Apr 2026 at 21:19, SATYANARAYANA NARLAPURAM > > wrote: > > > > > > PG19 added support for stats on virtual generated columns [1]. > Creating extended statistics on a virtual generated column whose expressi= on > can raise an error leads to ANALYZE failing repeatedly, and autovacuum > retrying indefinitely. This floods the server logs and also wastes > resources. Vacuum analyze on that column (without extended stats) succeed= s. > > > > > > > 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=E2=80=99m 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) skipping the extended sta= ts > 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=E2=80=99s responsibility to= notice > the warning > and address the underlying issue. > Yugo, thanks for the comments. Could you please review the v1 patch when yo= u get a chance. It is in the direction you suggested. Thanks, Satya --0000000000003faec2064f666203 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi

On Mon, Apr 13, 2= 026 at 11:24=E2=80=AFPM Yugo Nagata <nagata@sraoss.co.jp> wrote:
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
> <sat= yanarlapuram@gmail.com> wrote:
> >
> > PG19 added support for stats on virtual generated columns [1]. Cr= eating extended statistics on a virtual generated column whose expression c= an raise an error leads to ANALYZE failing repeatedly, and autovacuum retry= ing indefinitely. This floods the server logs and also wastes resources. Va= cuum 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=E2=80=99m not aware of a way to prevent i= t a priori.

>
> > In order to avoid retry storms, I think we have two options. (1) = skipping the offending row from the sample, (2) skipping the extended stats= computation for that table with a warning message. At least this avoid aut= ovacuum 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= 9;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 c= ause
errors and just emit a warning, rather than aborting ANALYZE for the entire= table.
It seems reasonable to treat this as the user=E2=80=99s responsibility to n= otice the warning
and address the underlying issue.

Yugo,= thanks for the comments. Could you please review the v1 patch when you
get a chance. It is in the direction you suggested.

Thanks,
Satya
=C2=A0
--0000000000003faec2064f666203--