Re: Allow to collect statistics on virtual generated columns

From: Yugo Nagata <nagata(at)sraoss(dot)co(dot)jp>
To: Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>
Cc: Andres Freund <andres(at)anarazel(dot)de>, pgsql-hackers(at)postgresql(dot)org, Yugo Nagata <nagata(at)sraoss(dot)co(dot)jp>
Subject: Re: Allow to collect statistics on virtual generated columns
Date: 2026-03-27 07:43:59
Message-ID: 20260327164359.ee19c1e71c80163517a1051e@sraoss.co.jp
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, 27 Mar 2026 14:35:11 +0900
Yugo Nagata <nagata(at)sraoss(dot)co(dot)jp> wrote:

> On Thu, 26 Mar 2026 17:44:01 +0000
> Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com> wrote:
>
> > On Thu, 26 Mar 2026 at 17:18, Yugo Nagata <nagata(at)sraoss(dot)co(dot)jp> wrote:
> > >
> > > On Thu, 26 Mar 2026 16:00:38 +0000
> > > Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com> wrote:
> > >
> > > > On Thu, 26 Mar 2026 at 15:09, Yugo Nagata <nagata(at)sraoss(dot)co(dot)jp> wrote:
> > > > >
> > > > > I've attached an updated patch including the documentation and tests.
> > > >
> > > > I think this is a much better approach.
> > > >
> > > > One thing that stands out in CreateStatistics() is that the check for
> > > > a less-than operator can be skipped if there is just a single virtual
> > > > generated column, for the same reason as for statistics on a single
> > > > expression. I.e., it should be possible to build statistics on a
> > > > single virtual generated column of any data type.
> > >
> > > I've attached a revised patch to skip the less-than operator check
> > > for a single virtual generated column.
> > >
> > > In fact, this change skips the check for any single column,
> > > not just virtual generated columns. However, using a non-virtual
> > > single column will result in an error elsewhere.
> >
> > Makes sense. I think the comments could just be simplified to say
> > "Disallow data types without a less-than operator in multivariate
> > statistics", and add the word "multivariate" to the error message, as
> > in the expression case.
>
> Agreed. I've attached a revised patch accordingly.

Sorry, I forgot to update the test along with the previous fix.
I've attached a revised patch including the updated test.

Regards,
Yugo Nagata

--
Yugo Nagata <nagata(at)sraoss(dot)co(dot)jp>

Attachment Content-Type Size
v11-0001-Allow-creating-extended-statistics-on-virtual-ge.patch text/x-diff 19.5 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2026-03-27 07:49:58 Re: Use SIGTERM instead of SIGUSR1 for slotsync worker to exit during promotion?
Previous Message Yasuo Honda 2026-03-27 07:41:36 Re: [PATCH] Fix unexpected loss of DEFERRABLE property after toggling NOT ENFORCED / ENFORCED