Re: Avoiding rewrite in ALTER TABLE ALTER TYPE - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Avoiding rewrite in ALTER TABLE ALTER TYPE
Date
Msg-id 11860.1293639383@sss.pgh.pa.us
Whole thread Raw
In response to Avoiding rewrite in ALTER TABLE ALTER TYPE  (Noah Misch <noah@leadboat.com>)
Responses Re: Avoiding rewrite in ALTER TABLE ALTER TYPE  (David Fetter <david@fetter.org>)
Re: Avoiding rewrite in ALTER TABLE ALTER TYPE  (Robert Haas <robertmhaas@gmail.com>)
Re: Avoiding rewrite in ALTER TABLE ALTER TYPE  (Noah Misch <noah@leadboat.com>)
List pgsql-hackers
Noah Misch <noah@leadboat.com> writes:
> ALTER TABLE ALTER TYPE always rewrites the table heap and its indexes.  In some
> cases, we can determine that doing so is unhelpful, and that the conversion
> shall always succeed:
> I wish to replace table rewrites with table verification scans where possible,
> then skip those verification scans where possible.

This has been discussed before; have you read the previous threads?

I really really dislike the notion of a "verification scan": it's
basically work that is going to be useless if it fails.  I think your
argument that it will usually fail quickly is quite unconvincing, and in
any case the situations where it is useful at all are too thin on the
ground to be worth the code space to implement it.  It seems sufficient
to me to skip the rewrite in cases of provable binary compatibility, with
possibly an extra check for "safe" changes of typmod.  With respect to
the latter, I agree a type-specific function to compare the typmods
would be the way to go, although "exemptor" seems a pretty badly chosen
name for it.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: Avoiding rewrite in ALTER TABLE ALTER TYPE
Next
From: "Li Jie"
Date:
Subject: Re: small table left outer join big table