Re: Preserve index stats during ALTER TABLE ... TYPE ... - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Preserve index stats during ALTER TABLE ... TYPE ...
Date
Msg-id 1375179.1760593099@sss.pgh.pa.us
Whole thread Raw
In response to Re: Preserve index stats during ALTER TABLE ... TYPE ...  (Michael Paquier <michael@paquier.xyz>)
Responses Re: Preserve index stats during ALTER TABLE ... TYPE ...
List pgsql-hackers
Michael Paquier <michael@paquier.xyz> writes:
> On Fri, Oct 10, 2025 at 07:37:59AM -0500, Sami Imseih wrote:
> As you can see, the index stats (linked to the column that has been altered) are
> not preserved. I think that they should be preserved (like a REINDEX does).

> Hmm.  Why should it be always OK to preserve the stats of an index
> when one of its attributes is changed so as a relation is rewritten?

Right offhand, this proposal seems utterly unsafe, to the point of
maybe introducing security-grade bugs.  I see that the patch compares
opfamilies but that seems insufficient, since "same opfamily" does not
mean "binary compatible".  We could easily be restoring stats whose
binary content is incompatible with the new column type.

            regards, tom lane



pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: Add mode column to pg_stat_progress_vacuum
Next
From: Michael Paquier
Date:
Subject: Re: remove partColsUpdated