Re: Extended Statistics set/restore/clear functions.

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Corey Huinker <corey(dot)huinker(at)gmail(dot)com>
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-29 05:13:49
Message-ID: aXrsjZQbVuB6236u@paquier.xyz
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Jan 28, 2026 at 03:06:59AM -0500, Corey Huinker wrote:
> - Now with fewer redundant null structures!
> - Changes to the documentation to reflect the fact that the *name
> parameters are all text types

Well, this has come up with a large set of issues, that I've taken on
me to address:
- v34 did not include a bunch of the fixes I've done in v33, like
error messages tweaks, typo fixes, comment adjustments, and some test
additions. So I had to come back to all that.
- After the removal of the nulls argument, a lot of comments still
reflected the behavior of the older patches back to when we had 4
arrays in input.
- The multirange test had no need to be in the main MCV patch, so I
have split that out as a change on its own.
- I have improved the output of the tests, especially for long MCV
values, splitting them with one line for each element. Same for the
format of the input. I was wondering about reducing the number of
MCVs, but decided against it as coverage seems more important to me
than some bloat of the SQL files.

Saying that, I have played more with the patch set and finished by
applying it what are to me the most relevant pieces I wanted to see
wrapped:
- Support for import of MCV values, including the pg_dump bits.
- Test with multirange type, good for coverage.
- Test with the stats cloning with data from an ANALYZE, that would
have been able to catch fc365e4fccc4, so it's a nice bonus.

Finally comes the final part of the proposal, as of v34-0002 for the
restore of expression stats. I have been wondering for a couple of
days if the proposed interface by relying on
pg_restore_extended_stats() combined with scans of pg_stats_ext_exprs
is the best thing we can do, and if a different approach with a
different function would be better. I don't have a clean answer to
this question yet, unfortunately.

What I am aware of though is that my schedule clock is unfortunately
ticking, meaning that I am running out of time to do more here as I
also need to focus on other things for this release. We have achieved
a lot already in terms of restore support for MCV, ndistinct and
dependencies, and I am curious to see how this will work out during
the beta cycle of v19 without the complexities related to expressions,
so it may not be a bad thing to cool down and see how the situation
evolves and if what's already been done requires any adjustments

PS: I have just noticed just two errmsg() that have been fat-fingered
for "cannot specify parameter" in extended_stats_funcs.c, will adjust
these in a bit. Sorry about that.
--
Michael

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message shveta malik 2026-01-29 05:33:05 Re: Proposal: Conflict log history table for Logical Replication
Previous Message Tom Lane 2026-01-29 05:12:46 Re: ATPrepCmd: cleanup unreachable AT_AddIndexConstraint handling