Re: Statistics Import and Export - Mailing list pgsql-hackers

From Jeff Davis
Subject Re: Statistics Import and Export
Date
Msg-id 51fca6b6c0032d28e053ad89f7e858e2a9e498af.camel@j-davis.com
Whole thread Raw
In response to Re: Statistics Import and Export  (Corey Huinker <corey.huinker@gmail.com>)
Responses Re: Statistics Import and Export
List pgsql-hackers
On Wed, 2025-02-26 at 04:25 -0500, Corey Huinker wrote:
> 0001 - Add attnum support to attribute_statistics_update
>
> * Basically what Tom posted earlier, minus the pg_set_attribute_stats
> stuff, obviously.

Should have a couple simple tests.

And I would use two different error message wordings:

  "must specify either attname or attnum"
  "cannot specify both attname and attnum"

(or similar)

The "one of attname and attnum" is a bit awkward.

The new struct for pg_clear_attribute_stats() isn't great, but as
discussed we can get rid of that in a subsequent commit.

Otherwise LGTM.

> 0002 - Add attnum support to pg_dump.
>
> * Removed att_stats_arginfo
> * Folds appendRelStatsImport and appendAttStatsImport
> into dumpRelationStats 

Can we add a test here, too, to check that tables dump the attname and
indexes dump the attnum?

Everything else in the file uses i_fieldname = PQfnumber(), but in this
patch you're just using raw numbers.

Some of the fields from pg_stats are NOT NULL, so we could consider
issuing a warning in that case rather than just skipping it.

And it could use a pgindent.

I ran a quick measurement and it appears within the noise of the
numbers I posted here:

https://www.postgresql.org/message-id/6af48508a32499a8be3398cafffd29fb6188c44b.camel@j-davis.com

Regards,
    Jeff Davis




pgsql-hackers by date:

Previous
From: Sadeq Dousti
Date:
Subject: Re: psql \dh: List High-Level (Root) Tables and Indexes
Next
From: Tom Lane
Date:
Subject: Re: Statistics Import and Export