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-27 08:48:02
Message-ID: CADkLM=dZr_Ut3jKw94_BisyyDtNZPRJWeOALXVzcJz=ZFTAhvQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

>
> So, I have done more work on all that, and extracted two more pieces,
> applying them:
> - The bits for dependencies in the restore function, .
> - The pg_dump bits for dependencies and n_distinct, as of
> c32fb29e979d. It was sad here that your posted patch did not use the
> keys of statistics_format.h. A comment was also missing in
> AdjustUpgrade.pm, where the code will be able to handle the "version"
> tag included in the dumps.
>

Hooray!

> Another thing that I strongly suspect is going to break in the
> buildfarm are the cross-version upgrades, because the format of
> the pg_dependencies and pg_ndistinct is not completely portable.
>

We had a similar rocky experience with pg_restore_relation_stats(), so your
concerns are warranted.

> This is a filter similar to the "version" field, except that we would
> replace all the contents of the pg_ndistinct and pg_dependencies
> values inside single quotes, protecting the dump comparisons for the
> new and old versions. Let's see first what the buildfarm says and if
> I need to pull this switch.
>

+1

> And it means that at this point we are feature-complete for these two
> stats kinds, so there will be at least something for this release even
> if MCV and expressions don't make it. Still, the other pieces should
> be slightly easier to integrate now that the core parts have been
> added.
> --
> Michael
>

And here's a rebased set

0001 - adds a test left out of dependencies
0002 - mcv (plus pgdump)
0003 - exprs (plus pgdump)
0004 - capstone set-difference test that could not have succeeded until all
stat kinds were implemented.

Attachment Content-Type Size
v32-0001-Add-output-test-for-pg_dependencies-statistics-i.patch application/x-patch 2.2 KB
v32-0002-Add-support-for-mcv-in-pg_restore_extended_stats.patch application/x-patch 45.3 KB
v32-0003-Add-support-for-exprs-in-pg_restore_extended_sta.patch application/x-patch 51.1 KB
v32-0004-Add-capstone-regression-test-for-pg_restore_exte.patch text/x-patch 12.4 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Zsolt Parragi 2026-01-27 08:55:23 Re: tablecmds: reject CLUSTER ON for partitioned tables earlier
Previous Message Amit Kapila 2026-01-27 08:46:10 Re: Newly created replication slot may be invalidated by checkpoint