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

From Yugo Nagata
Subject Re: Don't treat virtual generated columns as missing statistics in vacuumdb --missing-stats-only
Date
Msg-id 20250820133012.c3c013055f8409e4765a72e8@sraoss.co.jp
Whole thread Raw
In response to Re: Don't treat virtual generated columns as missing statistics in vacuumdb --missing-stats-only  (Fujii Masao <masao.fujii@gmail.com>)
Responses Re: Don't treat virtual generated columns as missing statistics in vacuumdb --missing-stats-only
List pgsql-hackers
On Wed, 20 Aug 2025 12:49:14 +0900
Fujii Masao <masao.fujii@gmail.com> wrote:

> 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?

Thank you for reviewing the patch and your suggestion.

I agree that we should add a test, since the behavior may change in the future
when statistics begin to be collected for virtual generated columns, and the test
will serve as a reminder when this behavior changes.

I've attached a updated patch including the test.

Regards,
Yugo Nagata

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

Attachment

pgsql-hackers by date:

Previous
From: Naga Appani
Date:
Subject: Re: [Proposal] Expose internal MultiXact member count function for efficient monitoring
Next
From: Fujii Masao
Date:
Subject: Re: analyze-in-stages post upgrade questions