Re: Don't treat virtual generated columns as missing statistics in vacuumdb --missing-stats-only

Fujii Masao <masao.fujii@gmail.com>

From: Fujii Masao <masao.fujii@gmail.com>
To: Yugo Nagata <nagata@sraoss.co.jp>
Cc: Pgsql Hackers <pgsql-hackers@postgresql.org>
Date: 2025-08-20T03:49:14Z
Lists: pgsql-hackers
On Wed, Aug 20, 2025 at 10:42 AM Yugo Nagata <nagata@sraoss.co.jp> wrote:
>
> Hi,
>
> I found that "vacuumdb --missing-stats-only" always performs ANALYZE
> on tables with a virtual generated column, since such columns currently
> never have statistics. This seems like an obvious waste, so I've attached
> a patch to fix it, ensuring that virtual generated columns are not
> regarded as missing statistics.

Thanks for the report and patch! This seems to be an oversight from
the commit that added virtual generated columns.

For the patch, shouldn't we also add a regression test for --missing-stats-only
with generated columns, to prevent this issue from happening again?

Regards,

-- 
Fujii Masao



Commits

  1. vacuumdb: Fix --missing-stats-only with virtual generated columns.