From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> |
Cc: | Ron <ronljohnsonjr(at)gmail(dot)com>, pgsql-admin <pgsql-admin(at)lists(dot)postgresql(dot)org> |
Subject: | Re: What to watch out for when ALTERing NUMERIC(38,0) to BIGINT? |
Date: | 2022-07-28 15:26:39 |
Message-ID: | 3421791.1659021999@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-admin |
"David G. Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> writes:
> On Thu, Jul 28, 2022 at 8:13 AM Ron <ronljohnsonjr(at)gmail(dot)com> wrote:
>> Besides what's mentioned in
>> https://www.postgresql.org/docs/12/ddl-alter.html#id-1.5.4.8.10, what
>> happens *internally* when I run:
>> ALTER TABLE foo ALTER COLUMN bar TYPE BIGINT;
> IIUC, that would be the silver lining in all of this - the rewritten table
> would have zero fragmentation and bloat.
Yeah. What happens internally is a table rewrite: the entire content
of the table (and its indexes) is written into a new set of files.
At commit, the old files are deleted. The main gotchas, for a large
table, are the transient disk space consumption and the fact that the
table stays exclusively locked the whole time.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Ron | 2022-07-28 17:41:41 | Re: What to watch out for when ALTERing NUMERIC(38,0) to BIGINT? |
Previous Message | David G. Johnston | 2022-07-28 15:19:38 | Re: What to watch out for when ALTERing NUMERIC(38,0) to BIGINT? |