Re: Cases where alter table set type varchar(longer length) still needs table rewrite

From: Jeremy Finzel <finzelj(at)gmail(dot)com>
To: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Postgres General <pgsql-general(at)postgresql(dot)org>
Subject: Re: Cases where alter table set type varchar(longer length) still needs table rewrite
Date: 2020-02-17 18:39:02
Message-ID: CAMa1XUjvFg0QVgcXTDpPn0o0ksjfdbAfz72o2kj6Ghy0=BTDoA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Feb 17, 2020 at 10:46 AM Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
wrote:

>
> How about?:
>
> https://www.postgresql.org/docs/9.6/sql-altertable.html
>
> "Adding a column with a DEFAULT clause or changing the type of an
> existing column will require the entire table and its indexes to be
> rewritten. As an exception when changing the type of an existing column,
> if the USING clause does not change the column contents and the old type
> is either binary coercible to the new type or an unconstrained domain
> over the new type, a table rewrite is not needed; but any indexes on the
> affected columns must still be rebuilt. Adding or removing a system oid
> column also requires rewriting the entire table. Table and/or index
> rebuilds may take a significant amount of time for a large table; and
> will temporarily require as much as double the disk space."
>
> >
> > Thanks!
> > Jeremy
>
>
> --
> Adrian Klaver
> adrian(dot)klaver(at)aklaver(dot)com

You mean the part "any indexes on the affected columns must still be
rebuilt"? Yes, I guess that is pretty clear. Thanks,

Jeremy

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Loai Abdallatif 2020-02-17 19:21:50 Re: Postgres error
Previous Message Tom Lane 2020-02-17 18:19:52 Re: Cases where alter table set type varchar(longer length) still needs table rewrite