Re: Extended Statistics set/restore/clear functions.

From: Corey Huinker <corey(dot)huinker(at)gmail(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>, Tender Wang <tndrwang(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Extended Statistics set/restore/clear functions.
Date: 2026-01-28 05:44:33
Message-ID: CADkLM=fxKO6YgA_LbPd+dKJFPXZdo0hQvk2fv3yGZYS7U4bVmA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Jan 27, 2026 at 11:50 PM Michael Paquier <michael(at)paquier(dot)xyz>
wrote:

> On Wed, Jan 28, 2026 at 01:34:12PM +0900, Michael Paquier wrote:
> > Could you look at the array bound issue please? Let's use the
> > attached as a base of work for now, this is what's standing now at the
> > top of my dev branch for the review of the MCV patch.
>
> By the way, why not just removing entirely most_common_val_nulls from
> the input arguments and rely on the values in most_common_vals to
> determine which value is NULL? It seems useless to me to have
> most_common_val_nulls knowing that we are relying already on
> deconstruct_array_builtin() to determine if the input values are NULL
> or not. That would also simplify the code a lot, especially in
> statext_mcv_import() where we check that either the input from
> most_common_val_nulls or the nulls array returned by
> deconstruct_array_builtin() are NULL to decide if we should check the
> input or not. And that would remove entirely the overread issue,
> reducing the input blast. :)
>

The short answer overcaution. The longer answer is we ingest it because
pg_mcv_list() returns it (
https://www.postgresql.org/docs/current/functions-statistics.html) and I
assumed that it must be necessary for some corner-case input, otherwise why
would pg_mcv_list() export it? In retrospect, its lack of presence in
pg_stats view should have been a clue that we could get by without it. I'm
happy to rip it out and submit another patchset.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2026-01-28 05:47:57 Re: pgsql: Prevent invalidation of newly synced replication slots.
Previous Message Soumya S Murali 2026-01-28 05:23:24 Re: Pasword expiration warning